Qx v0.7
Qt Extensions Library
Loading...
Searching...
No Matches
Qx::SqlResult< T > Class Template Reference

The SqlResult class provides sequential, efficient access to a SELECT/DQL query result. More...

#include <qx/sql/qx-sqlresult.h>

Public Member Functions

 SqlResult ()
 
int at () const
 
bool isEmpty () const
 
bool isValid () const
 
bool next ()
 
int size () const
 
SqlError value (T &value) const
 

Friends

class SqlDqlQuery
 

Detailed Description

template<QxSql::sql_struct T>
class Qx::SqlResult< T >

This class acts as an alternative way to process query results that is more efficient than the execution methods that simply return a container. Similar to a plain QSqlQuery, rows are navigated one at a time and the value(s) from them are constructed on-demand via value() instead of all at once.

A valid result obtained via executing a query will begin before the first row (if any), like QSqlQuery.

See also
isEmpty(), at(), size().

Constructor & Destructor Documentation

◆ SqlResult()

template<QxSql::sql_struct T>
Qx::SqlResult< T >::SqlResult ( )
inline

Constructs an invalid SqlResult.

Member Function Documentation

◆ at()

template<QxSql::sql_struct T>
int Qx::SqlResult< T >::at ( ) const
inline

Returns the current position of the query. The first record is at position zero. If the position is invalid, the function returns QxSql::BeforeFirstRow or QxSql::AfterLastRow, which are special negative values.

See also
next().

◆ isEmpty()

template<QxSql::sql_struct T>
bool Qx::SqlResult< T >::isEmpty ( ) const
inline

Returns true if the result returned no rows; otherwise, returns false.

◆ isValid()

template<QxSql::sql_struct T>
bool Qx::SqlResult< T >::isValid ( ) const
inline

Returns true if the result is currently positioned on a row of a successful; otherwise, returns false.

◆ next()

template<QxSql::sql_struct T>
bool Qx::SqlResult< T >::next ( )
inline

Advances the result to the next row.

Returns true if there was another row, or false if the end of the result was reached.

See also
at().

◆ size()

template<QxSql::sql_struct T>
int Qx::SqlResult< T >::size ( ) const
inline

Returns the size of the result.

◆ value()

template<QxSql::sql_struct T>
SqlError Qx::SqlResult< T >::value ( T & value) const
inline

Sets value to contain the data from the current row.

Returns a valid error object with error info if the data could not be retrieved.


The documentation for this class was generated from the following files: