Qt 4.8
|
The QSqlResult class provides an abstract interface for accessing data from specific SQL databases. More...
#include <qsqlresult.h>
Public Functions | |
virtual QVariant | handle () const |
Returns the low-level database handle for this result set wrapped in a QVariant or an invalid QVariant if there is no handle. More... | |
virtual | ~QSqlResult () |
Destroys the object and frees any allocated resources. More... | |
Protected Types | |
enum | BindingSyntax { PositionalBinding, NamedBinding } |
This enum type specifies the different syntaxes for specifying placeholders in prepared queries. More... | |
enum | VirtualHookOperation { BatchOperation, DetachFromResultSet, SetNumericalPrecision, NextResult } |
Protected Functions | |
void | addBindValue (const QVariant &val, QSql::ParamType type) |
Binds the value val of parameter type paramType to the next available position in the current record (row). More... | |
int | at () const |
Returns the current (zero-based) row position of the result. More... | |
BindingSyntax | bindingSyntax () const |
Returns the binding syntax used by prepared queries. More... | |
virtual void | bindValue (int pos, const QVariant &val, QSql::ParamType type) |
Binds the value val of parameter type paramType to position index in the current record (row). More... | |
virtual void | bindValue (const QString &placeholder, const QVariant &val, QSql::ParamType type) |
Binds the value val of parameter type paramType to the placeholder name in the current record (row). More... | |
QSql::ParamType | bindValueType (const QString &placeholder) const |
Returns the parameter type for the value bound with the given placeholder name. More... | |
QSql::ParamType | bindValueType (int pos) const |
Returns the parameter type for the value bound at position index. More... | |
QVariant | boundValue (const QString &placeholder) const |
Returns the value bound by the given placeholder name in the current record (row). More... | |
QVariant | boundValue (int pos) const |
Returns the value bound at position index in the current record (row). More... | |
int | boundValueCount () const |
Returns the number of bound values in the result. More... | |
QString | boundValueName (int pos) const |
Returns the name of the bound value at position index in the current record (row). More... | |
QVector< QVariant > & | boundValues () const |
Returns a vector of the result's bound values for the current record (row). More... | |
void | clear () |
Clears the entire result set and releases any associated resources. More... | |
virtual QVariant | data (int i)=0 |
Returns the data for field index in the current row as a QVariant. More... | |
void | detachFromResultSet () |
const QSqlDriver * | driver () const |
Returns the driver associated with the result. More... | |
virtual bool | exec () |
Executes the query, returning true if successful; otherwise returns false. More... | |
bool | execBatch (bool arrayBind=false) |
Executes a prepared query in batch mode if the driver supports it, otherwise emulates a batch execution using bindValue() and exec(). More... | |
QString | executedQuery () const |
Returns the query that was actually executed. More... | |
virtual bool | fetch (int i)=0 |
Positions the result to an arbitrary (zero-based) row index. More... | |
virtual bool | fetchFirst ()=0 |
Positions the result to the first record (row 0) in the result. More... | |
virtual bool | fetchLast ()=0 |
Positions the result to the last record (last row) in the result. More... | |
virtual bool | fetchNext () |
Positions the result to the next available record (row) in the result. More... | |
virtual bool | fetchPrevious () |
Positions the result to the previous record (row) in the result. More... | |
bool | hasOutValues () const |
Returns true if at least one of the query's bound values is a QSql::Out or a QSql::InOut; otherwise returns false. More... | |
bool | isActive () const |
Returns true if the result has records to be retrieved; otherwise returns false. More... | |
bool | isForwardOnly () const |
Returns true if you can only scroll forward through the result set; otherwise returns false. More... | |
virtual bool | isNull (int i)=0 |
Returns true if the field at position index in the current row is null; otherwise returns false. More... | |
bool | isSelect () const |
Returns true if the current result is from a SELECT statement; otherwise returns false. More... | |
bool | isValid () const |
Returns true if the result is positioned on a valid record (that is, the result is not positioned before the first or after the last record); otherwise returns false. More... | |
QSqlError | lastError () const |
Returns the last error associated with the result. More... | |
virtual QVariant | lastInsertId () const |
Returns the object ID of the most recent inserted row if the database supports it. More... | |
QString | lastQuery () const |
Returns the current SQL query text, or an empty string if there isn't one. More... | |
bool | nextResult () |
QSql::NumericalPrecisionPolicy | numericalPrecisionPolicy () const |
virtual int | numRowsAffected ()=0 |
Returns the number of rows affected by the last query executed, or -1 if it cannot be determined or if the query is a SELECT statement. More... | |
virtual bool | prepare (const QString &query) |
Prepares the given query for execution; the query will normally use placeholders so that it can be executed repeatedly. More... | |
QSqlResult (const QSqlDriver *db) | |
Creates a QSqlResult using database driver db. More... | |
virtual QSqlRecord | record () const |
Returns the current record if the query is active; otherwise returns an empty QSqlRecord. More... | |
virtual bool | reset (const QString &sqlquery)=0 |
Sets the result to use the SQL statement query for subsequent data retrieval. More... | |
virtual bool | savePrepare (const QString &sqlquery) |
Prepares the given query, using the underlying database functionality where possible. More... | |
virtual void | setActive (bool a) |
This function is provided for derived classes to set the internal active state to active. More... | |
virtual void | setAt (int at) |
This function is provided for derived classes to set the internal (zero-based) row position to index. More... | |
virtual void | setForwardOnly (bool forward) |
Sets forward only mode to forward. More... | |
virtual void | setLastError (const QSqlError &e) |
This function is provided for derived classes to set the last error to error. More... | |
void | setNumericalPrecisionPolicy (QSql::NumericalPrecisionPolicy policy) |
virtual void | setQuery (const QString &query) |
Sets the current query for the result to query. More... | |
virtual void | setSelect (bool s) |
This function is provided for derived classes to indicate whether or not the current statement is a SQL SELECT statement. More... | |
virtual int | size ()=0 |
Returns the size of the SELECT result, or -1 if it cannot be determined or if the query is not a SELECT statement. More... | |
virtual void | virtual_hook (int id, void *data) |
Private Functions | |
void | resetBindCount () |
Properties | |
QSqlResultPrivate * | d |
Friends | |
class | QSqlQuery |
class | QSqlResultPrivate |
class | QSqlTableModelPrivate |
The QSqlResult class provides an abstract interface for accessing data from specific SQL databases.
Normally, you would use QSqlQuery instead of QSqlResult, since QSqlQuery provides a generic wrapper for database-specific implementations of QSqlResult.
If you are implementing your own SQL driver (by subclassing QSqlDriver), you will need to provide your own QSqlResult subclass that implements all the pure virtual functions and other virtual functions that you need.
Definition at line 63 of file qsqlresult.h.
|
protected |
This enum type specifies the different syntaxes for specifying placeholders in prepared queries.
Enumerator | |
---|---|
PositionalBinding | |
NamedBinding |
Definition at line 74 of file qsqlresult.h.
|
protected |
Enumerator | |
---|---|
BatchOperation | |
DetachFromResultSet | |
SetNumericalPrecision | |
NextResult |
Definition at line 133 of file qsqlresult.h.
|
virtual |
Destroys the object and frees any allocated resources.
Definition at line 270 of file qsqlresult.cpp.
|
explicitprotected |
Creates a QSqlResult using database driver db.
The object is initialized to an inactive state.
Definition at line 257 of file qsqlresult.cpp.
|
protected |
Binds the value val of parameter type paramType to the next available position in the current record (row).
Definition at line 784 of file qsqlresult.cpp.
|
protected |
Returns the current (zero-based) row position of the result.
May return the special values QSql::BeforeFirstRow or QSql::AfterLastRow.
Definition at line 306 of file qsqlresult.cpp.
Referenced by QSqlCachedResult::cacheNext(), QPSQLResult::data(), QSqlCachedResult::data(), QDB2Result::fetch(), QSymSQLResult::fetch(), QPSQLResult::fetch(), QMYSQLResult::fetch(), QSqlCachedResult::fetch(), QODBCResult::fetch(), QDB2Result::fetchFirst(), QMYSQLResult::fetchFirst(), QSqlCachedResult::fetchFirst(), QODBCResult::fetchFirst(), QDB2Result::fetchLast(), QSymSQLResult::fetchLast(), QMYSQLResult::fetchLast(), QSqlCachedResult::fetchLast(), QODBCResult::fetchLast(), QDB2Result::fetchNext(), QSymSQLResult::fetchNext(), QMYSQLResult::fetchNext(), QSqlCachedResult::fetchNext(), QODBCResult::fetchNext(), QSqlCachedResult::fetchPrevious(), QODBCResult::fetchPrevious(), QOCIResult::gotoNext(), QSqlCachedResult::isNull(), and QPSQLResult::isNull().
|
protected |
|
protectedvirtual |
Binds the value val of parameter type paramType to position index in the current record (row).
Reimplemented in QSqlNullResult.
Definition at line 727 of file qsqlresult.cpp.
|
protectedvirtual |
Binds the value val of parameter type paramType to the placeholder name in the current record (row).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Values cannot be bound to multiple locations in the query, eg:
Binding to name will bind to the first :name, but not the second.
Reimplemented in QSqlNullResult.
Definition at line 757 of file qsqlresult.cpp.
|
protected |
Returns the parameter type for the value bound with the given placeholder name.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 838 of file qsqlresult.cpp.
Referenced by QDB2Result::exec(), QODBCResult::exec(), QOCIResultPrivate::isBinaryValue(), and QOCIResultPrivate::isOutValue().
|
protected |
Returns the parameter type for the value bound at position index.
Definition at line 824 of file qsqlresult.cpp.
Returns the value bound by the given placeholder name in the current record (row).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 813 of file qsqlresult.cpp.
|
protected |
Returns the value bound at position index in the current record (row).
Definition at line 797 of file qsqlresult.cpp.
|
protected |
Returns the number of bound values in the result.
Definition at line 848 of file qsqlresult.cpp.
Referenced by QOCIResult::exec().
|
protected |
Returns the name of the bound value at position index in the current record (row).
Definition at line 905 of file qsqlresult.cpp.
Returns a vector of the result's bound values for the current record (row).
Definition at line 859 of file qsqlresult.cpp.
Referenced by QIBaseResult::exec(), QDB2Result::exec(), QOCIResult::exec(), QSQLiteResult::exec(), QSymSQLResult::exec(), QPSQLResult::exec(), QODBCResult::exec(), QOCIResult::virtual_hook(), and QMYSQLResult::virtual_hook().
|
protected |
Clears the entire result set and releases any associated resources.
Definition at line 876 of file qsqlresult.cpp.
|
protectedpure virtual |
Returns the data for field index in the current row as a QVariant.
This function is only called if the result is in an active state and is positioned on a valid record and index is non-negative. Derived classes must reimplement this function and return the value of field index, or QVariant() if it cannot be determined.
Implemented in QODBCResult, QMYSQLResult, QPSQLResult, QSqlCachedResult, QSymSQLResult, QDB2Result, and QSqlNullResult.
|
protected |
Definition at line 1020 of file qsqlresult.cpp.
|
protected |
Returns the driver associated with the result.
This is the object that was passed to the constructor.
Definition at line 389 of file qsqlresult.cpp.
Referenced by QIBaseResult::exec(), QPSQLResult::exec(), QODBCResult::fetch(), QIBaseResult::prepare(), QSQLiteResult::prepare(), QSymSQLResult::prepare(), QODBCResult::prepare(), QSQLite2Result::reset(), QPSQLResult::reset(), QMYSQLResult::reset(), QTDSResult::reset(), QODBCResult::reset(), QODBCResult::~QODBCResult(), and QSQLiteResult::~QSQLiteResult().
|
protectedvirtual |
Executes the query, returning true if successful; otherwise returns false.
Reimplemented in QODBCResult, QPSQLResult, QSqlNullResult, QSymSQLResult, QSQLiteResult, QOCIResult, QDB2Result, and QIBaseResult.
Definition at line 675 of file qsqlresult.cpp.
Referenced by QPSQLResult::exec(), and QMYSQLResult::virtual_hook().
|
protected |
Executes a prepared query in batch mode if the driver supports it, otherwise emulates a batch execution using bindValue() and exec().
QSqlDriver::hasFeature() can be used to find out whether a driver supports batch execution.
Batch execution can be faster for large amounts of data since it reduces network roundtrips.
For batch executions, bound values have to be provided as lists of variants (QVariantList).
Each list must contain values of the same type. All lists must contain equal amount of values (rows).
NULL values are passed in as typed QVariants, for example {QVariant(QVariant::Int)}
for an integer NULL value.
Example:
Here, we insert two rows into a SQL table, with each row containing three values.
Definition at line 997 of file qsqlresult.cpp.
|
protected |
Returns the query that was actually executed.
This may differ from the query that was passed, for example if bound values were used with a prepared query and the underlying database doesn't support prepared queries.
Definition at line 889 of file qsqlresult.cpp.
|
protectedpure virtual |
Positions the result to an arbitrary (zero-based) row index.
This function is only called if the result is in an active state. Derived classes must reimplement this function and position the result to the row index, and call setAt() with an appropriate value. Return true to indicate success, or false to signify failure.
Implemented in QODBCResult, QSqlCachedResult, QMYSQLResult, QPSQLResult, QSymSQLResult, QDB2Result, and QSqlNullResult.
|
protectedpure virtual |
Positions the result to the first record (row 0) in the result.
This function is only called if the result is in an active state. Derived classes must reimplement this function and position the result to the first record, and call setAt() with an appropriate value. Return true to indicate success, or false to signify failure.
Implemented in QODBCResult, QSqlCachedResult, QMYSQLResult, QSymSQLResult, QPSQLResult, QDB2Result, and QSqlNullResult.
|
protectedpure virtual |
Positions the result to the last record (last row) in the result.
This function is only called if the result is in an active state. Derived classes must reimplement this function and position the result to the last record, and call setAt() with an appropriate value. Return true to indicate success, or false to signify failure.
Implemented in QODBCResult, QSqlCachedResult, QMYSQLResult, QSymSQLResult, QPSQLResult, QDB2Result, and QSqlNullResult.
|
protectedvirtual |
Positions the result to the next available record (row) in the result.
This function is only called if the result is in an active state. The default implementation calls fetch() with the next index. Derived classes can reimplement this function and position the result to the next record in some other way, and call setAt() with an appropriate value. Return true to indicate success, or false to signify failure.
Reimplemented in QODBCResult, QSqlCachedResult, QMYSQLResult, QSymSQLResult, and QDB2Result.
Definition at line 555 of file qsqlresult.cpp.
|
protectedvirtual |
Positions the result to the previous record (row) in the result.
This function is only called if the result is in an active state. The default implementation calls fetch() with the previous index. Derived classes can reimplement this function and position the result to the next record in some other way, and call setAt() with an appropriate value. Return true to indicate success, or false to signify failure.
Reimplemented in QODBCResult, QSqlCachedResult, and QSymSQLResult.
Definition at line 571 of file qsqlresult.cpp.
Referenced by QSymSQLResult::fetchPrevious().
|
virtual |
Returns the low-level database handle for this result set wrapped in a QVariant or an invalid QVariant if there is no handle.
The handle returned here is database-dependent, you should query the type name of the variant before accessing it.
This example retrieves the handle for a sqlite result:
This snippet returns the handle for PostgreSQL or MySQL:
Reimplemented in QODBCResult, QTDSResult, QMYSQLResult, QOCIResult, QPSQLResult, QSQLite2Result, QSymSQLResult, QSQLiteResult, QDB2Result, and QIBaseResult.
Definition at line 1078 of file qsqlresult.cpp.
|
protected |
Returns true if at least one of the query's bound values is a QSql::Out
or a QSql::InOut; otherwise returns false.
Definition at line 916 of file qsqlresult.cpp.
Referenced by QDB2Result::exec(), QOCIResult::exec(), and QODBCResult::exec().
|
protected |
Returns true if the result has records to be retrieved; otherwise returns false.
Definition at line 340 of file qsqlresult.cpp.
Referenced by QSymSQLResult::fetch(), QPSQLResult::fetch(), QSqlCachedResult::fetch(), QSymSQLResult::fetchLast(), QSQLiteResult::lastInsertId(), QOCIResult::lastInsertId(), QPSQLResult::lastInsertId(), QMYSQLResult::lastInsertId(), QSymSQLResult::lastInsertId(), QIBaseResult::record(), QSQLite2Result::record(), QDB2Result::record(), QSQLiteResult::record(), QOCIResult::record(), QPSQLResult::record(), QSymSQLResult::record(), QMYSQLResult::record(), QODBCResult::record(), QMYSQLResult::reset(), and QIBaseResult::size().
|
protected |
Returns true if you can only scroll forward through the result set; otherwise returns false.
Definition at line 582 of file qsqlresult.cpp.
Referenced by QSqlCachedResult::cacheNext(), QDB2Result::exec(), QDB2Result::fetch(), QMYSQLResult::fetch(), QODBCResult::fetch(), QDB2Result::fetchFirst(), QMYSQLResult::fetchFirst(), QODBCResult::fetchFirst(), QDB2Result::fetchLast(), QMYSQLResult::fetchLast(), QODBCResult::fetchLast(), QODBCResult::fetchPrevious(), QSqlCachedResult::init(), QDB2Result::prepare(), and QDB2Result::reset().
|
protectedpure virtual |
Returns true if the field at position index in the current row is null; otherwise returns false.
Implemented in QODBCResult, QMYSQLResult, QPSQLResult, QSqlCachedResult, QDB2Result, QSymSQLResult, and QSqlNullResult.
|
protected |
Returns true if the current result is from a SELECT
statement; otherwise returns false.
Definition at line 379 of file qsqlresult.cpp.
Referenced by QMYSQLResult::data(), QIBaseResult::exec(), QODBCResult::exec(), QMYSQLResult::nextResult(), QIBaseResult::prepare(), QSQLite2Result::record(), QSQLiteResult::record(), QOCIResult::record(), QPSQLResult::record(), QSymSQLResult::record(), QMYSQLResult::record(), QODBCResult::record(), QMYSQLResult::reset(), QIBaseResult::size(), QMYSQLResult::size(), and QMYSQLResult::virtual_hook().
|
protected |
Returns true if the result is positioned on a valid record (that is, the result is not positioned before the first or after the last record); otherwise returns false.
Definition at line 320 of file qsqlresult.cpp.
Referenced by QSQLiteResult::exec(), QSymSQLResult::exec(), and QSQLite2Result::reset().
|
protected |
Returns the last error associated with the result.
Definition at line 427 of file qsqlresult.cpp.
Referenced by QSQLiteResult::exec(), QSymSQLResult::exec(), and QSQLite2Result::reset().
|
protectedvirtual |
Returns the object ID of the most recent inserted row if the database supports it.
An invalid QVariant will be returned if the query did not insert any value or if the database does not report the id back. If more than one row was touched by the insert, the behavior is undefined.
Note that for Oracle databases the row's ROWID will be returned, while for MySQL databases the row's auto-increment field will be returned.
Reimplemented in QSymSQLResult, QMYSQLResult, QPSQLResult, QOCIResult, and QSQLiteResult.
Definition at line 955 of file qsqlresult.cpp.
|
protected |
Returns the current SQL query text, or an empty string if there isn't one.
Definition at line 294 of file qsqlresult.cpp.
Referenced by QOCIResult::exec(), QSymSQLResult::exec(), and QOCIResult::gotoNext().
|
protected |
Definition at line 1044 of file qsqlresult.cpp.
|
protected |
Definition at line 1037 of file qsqlresult.cpp.
Referenced by QDB2Result::data(), QSymSQLResult::data(), QPSQLResult::data(), QMYSQLResult::data(), QODBCResult::data(), QSQLiteResultPrivate::fetchNext(), QOCICols::getValues(), QIBaseResult::gotoNext(), and QOCICols::qMakeOraField().
|
protectedpure virtual |
Returns the number of rows affected by the last query executed, or -1 if it cannot be determined or if the query is a SELECT
statement.
Implemented in QODBCResult, QTDSResult, QMYSQLResult, QSymSQLResult, QPSQLResult, QOCIResult, QDB2Result, QSQLiteResult, QSQLite2Result, QSqlNullResult, and QIBaseResult.
|
protectedvirtual |
Prepares the given query for execution; the query will normally use placeholders so that it can be executed repeatedly.
Returns true if the query is prepared successfully; otherwise returns false.
Reimplemented in QODBCResult, QPSQLResult, QSqlNullResult, QSymSQLResult, QSQLiteResult, QOCIResult, QDB2Result, and QIBaseResult.
Definition at line 641 of file qsqlresult.cpp.
Referenced by QOCIResult::prepare(), QPSQLResult::prepare(), and QMYSQLResult::virtual_hook().
|
protectedvirtual |
Returns the current record if the query is active; otherwise returns an empty QSqlRecord.
The default implementation always returns an empty QSqlRecord.
Reimplemented in QODBCResult, QTDSResult, QMYSQLResult, QSymSQLResult, QPSQLResult, QOCIResult, QDB2Result, QSQLiteResult, QSQLite2Result, and QIBaseResult.
Definition at line 936 of file qsqlresult.cpp.
|
protectedpure virtual |
Sets the result to use the SQL statement query for subsequent data retrieval.
Derived classes must reimplement this function and apply the query to the database. This function is only called after the result is set to an inactive state and is positioned before the first record of the new result. Derived classes should return true if the query was successful and ready to be used, or false otherwise.
Implemented in QODBCResult, QTDSResult, QMYSQLResult, QPSQLResult, QSymSQLResult, QOCIResult, QSQLite2Result, QSQLiteResult, QDB2Result, QIBaseResult, and QSqlNullResult.
|
private |
Definition at line 894 of file qsqlresult.cpp.
|
protectedvirtual |
Prepares the given query, using the underlying database functionality where possible.
Returns true if the query is prepared successfully; otherwise returns false.
Reimplemented in QSqlNullResult.
Definition at line 615 of file qsqlresult.cpp.
|
protectedvirtual |
This function is provided for derived classes to set the internal active state to active.
Reimplemented in QSqlNullResult.
Definition at line 402 of file qsqlresult.cpp.
Referenced by QSqlCachedResult::cleanup(), QPSQLResult::cleanup(), QMYSQLResult::cleanup(), QSQLite2ResultPrivate::cleanup(), QSQLiteResultPrivate::cleanup(), QSymSQLResultPrivate::cleanup(), QIBaseResult::exec(), QDB2Result::exec(), QOCIResult::exec(), QSQLiteResult::exec(), QSymSQLResult::exec(), QODBCResult::exec(), QOCICols::execBatch(), QDB2Result::nextResult(), QMYSQLResult::nextResult(), QODBCResult::nextResult(), QIBaseResult::prepare(), QDB2Result::prepare(), QODBCResult::prepare(), QDB2Result::reset(), QSQLite2Result::reset(), QMYSQLResult::reset(), QTDSResult::reset(), QODBCResult::reset(), and QMYSQLResult::virtual_hook().
|
protectedvirtual |
This function is provided for derived classes to set the internal (zero-based) row position to index.
Reimplemented in QSqlNullResult.
Definition at line 352 of file qsqlresult.cpp.
Referenced by QSqlCachedResult::cacheNext(), QSqlCachedResult::cleanup(), QPSQLResult::cleanup(), QMYSQLResult::cleanup(), QSQLite2ResultPrivate::cleanup(), QSQLiteResultPrivate::cleanup(), QSymSQLResultPrivate::cleanup(), QSqlCachedResult::clearValues(), QIBaseResult::exec(), QDB2Result::exec(), QOCIResult::exec(), QSymSQLResult::exec(), QODBCResult::exec(), QOCICols::execBatch(), QDB2Result::fetch(), QSymSQLResult::fetch(), QPSQLResult::fetch(), QMYSQLResult::fetch(), QSqlCachedResult::fetch(), QODBCResult::fetch(), QDB2Result::fetchFirst(), QSqlCachedResult::fetchFirst(), QODBCResult::fetchFirst(), QDB2Result::fetchLast(), QSymSQLResult::fetchLast(), QSqlCachedResult::fetchLast(), QODBCResult::fetchLast(), QDB2Result::fetchNext(), QSymSQLResult::fetchNext(), QMYSQLResult::fetchNext(), QSqlCachedResult::fetchNext(), QODBCResult::fetchNext(), QSQLite2ResultPrivate::fetchNext(), QSQLiteResultPrivate::fetchNext(), QSymSQLResultPrivate::fetchNext(), QODBCResult::fetchPrevious(), QIBaseResult::gotoNext(), QOCIResult::gotoNext(), QTDSResult::gotoNext(), QDB2Result::nextResult(), QMYSQLResult::nextResult(), QODBCResult::nextResult(), QIBaseResult::prepare(), QDB2Result::prepare(), QODBCResult::prepare(), QDB2Result::reset(), QMYSQLResult::reset(), QTDSResult::reset(), QODBCResult::reset(), and QMYSQLResult::virtual_hook().
|
protectedvirtual |
Sets forward only mode to forward.
If forward is true, only fetchNext() is allowed for navigating the results. Forward only mode needs much less memory since results do not have to be cached. By default, this feature is disabled.
Setting forward only to false is a suggestion to the database engine, which has the final say on whether a result set is forward only or scrollable. isForwardOnly() will always return the correct status of the result set.
Reimplemented in QODBCResult, and QSqlNullResult.
Definition at line 603 of file qsqlresult.cpp.
Referenced by QODBCResult::exec(), QODBCResult::reset(), and QODBCResult::setForwardOnly().
|
protectedvirtual |
This function is provided for derived classes to set the last error to error.
Reimplemented in QSqlNullResult.
Definition at line 417 of file qsqlresult.cpp.
Referenced by QDB2Result::exec(), QOCIResult::exec(), QSQLiteResult::exec(), QSymSQLResult::exec(), QODBCResult::exec(), QOCICols::execBatch(), QDB2Result::fetch(), QMYSQLResult::fetch(), QODBCResult::fetch(), QDB2Result::fetchFirst(), QODBCResult::fetchFirst(), QODBCResult::fetchLast(), QDB2Result::fetchNext(), QMYSQLResult::fetchNext(), QODBCResult::fetchNext(), QSQLiteResultPrivate::fetchNext(), QSymSQLResultPrivate::fetchNext(), QODBCResult::fetchPrevious(), QSQLite2ResultPrivate::finalize(), QOCIResult::gotoNext(), QTDSResult::gotoNext(), QSymSQLResultPrivate::initColumns(), QDB2Result::nextResult(), QMYSQLResult::nextResult(), QODBCResult::nextResult(), QDB2Result::prepare(), QOCIResult::prepare(), QSQLiteResult::prepare(), QSymSQLResult::prepare(), QODBCResult::prepare(), QPSQLResult::prepare(), QSqlNullResult::QSqlNullResult(), QDB2Result::reset(), QSQLite2Result::reset(), QMYSQLResult::reset(), QTDSResult::reset(), QODBCResult::reset(), QMYSQLResult::virtual_hook(), and QIBaseResultPrivate::writeArray().
|
protected |
Definition at line 1029 of file qsqlresult.cpp.
|
protectedvirtual |
Sets the current query for the result to query.
You must call reset() to execute the query on the database.
Reimplemented in QSqlNullResult.
Definition at line 282 of file qsqlresult.cpp.
|
protectedvirtual |
This function is provided for derived classes to indicate whether or not the current statement is a SQL SELECT
statement.
The select parameter should be true if the statement is a SELECT
statement; otherwise it should be false.
Reimplemented in QSqlNullResult.
Definition at line 367 of file qsqlresult.cpp.
Referenced by QDB2Result::exec(), QOCIResult::exec(), QSQLiteResult::exec(), QSymSQLResult::exec(), QODBCResult::exec(), QOCICols::execBatch(), QDB2Result::nextResult(), QMYSQLResult::nextResult(), QODBCResult::nextResult(), QIBaseResult::prepare(), QSQLiteResult::prepare(), QSymSQLResult::prepare(), QDB2Result::reset(), QSQLite2Result::reset(), QMYSQLResult::reset(), QTDSResult::reset(), QODBCResult::reset(), and QMYSQLResult::virtual_hook().
|
protectedpure virtual |
Returns the size of the SELECT
result, or -1 if it cannot be determined or if the query is not a SELECT
statement.
Implemented in QODBCResult, QTDSResult, QMYSQLResult, QSymSQLResult, QPSQLResult, QOCIResult, QDB2Result, QSQLiteResult, QSQLite2Result, QSqlNullResult, and QIBaseResult.
|
protectedvirtual |
Reimplemented in QODBCResult, QSqlCachedResult, QMYSQLResult, QSymSQLResult, QOCIResult, QDB2Result, QSQLiteResult, QSQLite2Result, and QPSQLResult.
Definition at line 962 of file qsqlresult.cpp.
Referenced by QPSQLResult::virtual_hook(), QDB2Result::virtual_hook(), QSymSQLResult::virtual_hook(), QMYSQLResult::virtual_hook(), QSqlCachedResult::virtual_hook(), and QODBCResult::virtual_hook().
Definition at line 65 of file qsqlresult.h.
|
friend |
Definition at line 67 of file qsqlresult.h.
|
friend |
Definition at line 66 of file qsqlresult.h.
|
private |
Definition at line 142 of file qsqlresult.h.