Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions | ![]() |
The QSqlResult class provides an abstract interface for accessing data from SQL databases. More...
#include <QSqlResult>
The QSqlResult class provides an abstract interface for accessing data from 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 you will need to provide your own QSqlResult subclass that implements all the pure virtual functions, and the other virtual functions that you need, (as well as a QSqlDriver subclass).
See also QSql.
QSqlResult::BindByPosition | |
QSqlResult::BindByName |
This constructor creates a QSqlResult using database db. The object is initialized to an inactive state.
Destroys the object and frees any allocated resources.
Binds the value val of parameter type tp to the next available position in the current record (row).
Returns the current (zero-based) row position of the result.
Returns the bind method used for prepared queries, either BindByPosition or BindByName.
Binds the value val of parameter type tp to position pos in the current record (row).
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Binds the value val of parameter type tp to the placeholder name in the current record (row).
Returns the parameter type for the value bound at position pos.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Returns the parameter type for the value bound with the given placeholder name.
Returns the value bound at position pos in the current record (row).
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Returns the value bound by the given placeholder name in the current record (row).
Returns the number of bound values in the result.
See also boundValues().
Returns the name of the bound value at position pos in the current record (row).
Returns a vector of the result's bound values for the current record (row).
See also boundValueCount().
Clears the entire result set and releases any associated resources.
Returns the data for field i (zero-based) in the current row as a QCoreVariant. This function is only called if the result is in an active state and is positioned on a valid record and i is non-negative. Derived classes must reimplement this function and return the value of field i, or QCoreVariant() if it cannot be determined.
Returns the driver associated with the result.
Executes the query.
See also prepare().
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.
Positions the result to an arbitrary (zero-based) row i. 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 i, and call setAt() with an appropriate value. Return true to indicate success, or false to signify failure.
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.
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.
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.
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.
Returns true if at least one of the query's bound values is a QSql::Out or a QSql::InOut; otherwise returns false.
Returns true if the result has records to be retrieved; otherwise returns false.
Returns true if you can only scroll forward through the result set; otherwise returns false.
See also setForwardOnly().
Returns true if the field at position i in the current row is NULL; otherwise returns false.
Returns true if the current result is from a SELECT statement; otherwise returns false.
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.
Returns the last error associated with the result.
Returns the current SQL query text, or an empty string if there isn't one.
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.
See also size().
Prepares the given query for execution; the query will normally use placeholders so that it can be repeatedly executed.
The base class implementation does nothing and returns an empty QSqlRecord.
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.
Prepares the given query, using the underlying database functionality where possible.
This function is provided for derived classes to set the internal active state to the value of a.
See also isActive().
This function is provided for derived classes to set the internal (zero-based) row position to at.
See also at().
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. forward only mode is off by default.
See also isForwardOnly() and fetchNext().
This function is provided for derived classes to set the last error to the value of e.
See also lastError().
Sets the current query for the result to query. The result must be reset() in order to execute the query on the database.
This function is provided for derived classes to indicate whether or not the current statement is a SQL SELECT statement. The s parameter should be true if the statement is a SELECT statement; otherwise it should be false.
Returns the size of the result or -1 if it cannot be determined or if the query is not a SELECT statement.
See also numRowsAffected().
Copyright © 2004 Trolltech. | Trademarks | Qt 4.0.0-tp1 |