Eneboo - Documentación para desarrolladores
|
The QSqlResult class provides an abstract interface for accessing data from SQL databases. Más...
#include <qsqlresult.h>
Métodos públicos | |
virtual | ~QSqlResult () |
void | setExtension (QSqlExtension *ext) |
QSqlExtension * | extension () |
virtual | ~QSqlResult () |
void | setExtension (QSqlExtension *ext) |
QSqlExtension * | extension () |
Métodos protegidos | |
QSqlResult (const QSqlDriver *db) | |
int | at () const |
QString | lastQuery () const |
QSqlError | lastError () const |
bool | isValid () const |
bool | isActive () const |
bool | isSelect () const |
bool | isForwardOnly () const |
const QSqlDriver * | driver () const |
virtual void | setAt (int at) |
virtual void | setActive (bool a) |
virtual void | setLastError (const QSqlError &e) |
virtual void | setQuery (const QString &query) |
virtual void | setSelect (bool s) |
virtual void | setForwardOnly (bool forward) |
virtual QVariant | data (int i)=0 |
virtual bool | isNull (int i)=0 |
virtual bool | reset (const QString &sqlquery)=0 |
virtual bool | fetch (int i)=0 |
virtual bool | fetchNext () |
virtual bool | fetchPrev () |
virtual bool | fetchFirst ()=0 |
virtual bool | fetchLast ()=0 |
virtual int | size ()=0 |
virtual int | numRowsAffected ()=0 |
QSqlResult (const QSqlDriver *db) | |
int | at () const |
QString | lastQuery () const |
QSqlError | lastError () const |
bool | isValid () const |
bool | isActive () const |
bool | isSelect () const |
bool | isForwardOnly () const |
const QSqlDriver * | driver () const |
virtual void | setAt (int at) |
virtual void | setActive (bool a) |
virtual void | setLastError (const QSqlError &e) |
virtual void | setQuery (const QString &query) |
virtual void | setSelect (bool s) |
virtual void | setForwardOnly (bool forward) |
virtual QVariant | data (int i)=0 |
virtual bool | isNull (int i)=0 |
virtual bool | reset (const QString &sqlquery)=0 |
virtual bool | fetch (int i)=0 |
virtual bool | fetchNext () |
virtual bool | fetchPrev () |
virtual bool | fetchFirst ()=0 |
virtual bool | fetchLast ()=0 |
virtual int | size ()=0 |
virtual int | numRowsAffected ()=0 |
Amigas | |
class | QSqlQuery |
class | QSqlResultShared |
The QSqlResult class provides an abstract interface for accessing data from SQL databases.
sql
Normally you would use QSqlQuery instead of QSqlResult since QSqlQuery provides a generic wrapper for database-specific implementations of QSqlResult.
QSqlResult::~QSqlResult | ( | ) | [virtual] |
Destroys the object and frees any allocated resources.
QSqlResult::QSqlResult | ( | const QSqlDriver * | db | ) | [protected] |
Protected constructor which creates a QSqlResult using database db. The object is initialized to an inactive state.
virtual QSqlResult::~QSqlResult | ( | ) | [virtual] |
QSqlResult::QSqlResult | ( | const QSqlDriver * | db | ) | [protected] |
int QSqlResult::at | ( | ) | const [protected] |
Returns the current (zero-based) position of the result.
int QSqlResult::at | ( | ) | const [protected] |
Returns the data for field i (zero-based) as a QVariant. 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 QVariant() if it cannot be determined.
Implementado en QMYSQLResult, QPSQLResult, SqliteResult, QtSqlCachedResult, QMYSQLResult, QODBCResult, QPSQLResult y QNullResult.
Implementado en QMYSQLResult, QPSQLResult, SqliteResult, QtSqlCachedResult, QMYSQLResult, QODBCResult, QPSQLResult y QNullResult.
const QSqlDriver * QSqlResult::driver | ( | ) | const [protected] |
Returns the driver associated with the result.
const QSqlDriver* QSqlResult::driver | ( | ) | const [protected] |
QSqlExtension * QSqlResult::extension | ( | ) |
QSqlExtension* QSqlResult::extension | ( | ) |
Positions the result to an arbitrary (zero-based) index 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 index i, and call setAt() with an appropriate value. Return TRUE to indicate success, or FALSE to signify failure.
Implementado en QMYSQLResult, QPSQLResult, SqliteResult, QtSqlCachedResult, QMYSQLResult, QODBCResult, QPSQLResult y QNullResult.
Implementado en QMYSQLResult, QPSQLResult, SqliteResult, QtSqlCachedResult, QMYSQLResult, QODBCResult, QPSQLResult y QNullResult.
bool QSqlResult::fetchFirst | ( | ) | [protected, pure virtual] |
Positions the result to the first record 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.
Implementado en QMYSQLResult, QPSQLResult, SqliteResult, QtSqlCachedResult, QMYSQLResult, QODBCResult, QPSQLResult y QNullResult.
virtual bool QSqlResult::fetchFirst | ( | ) | [protected, pure virtual] |
Implementado en QMYSQLResult, QPSQLResult, SqliteResult, QtSqlCachedResult, QMYSQLResult, QODBCResult, QPSQLResult y QNullResult.
bool QSqlResult::fetchLast | ( | ) | [protected, pure virtual] |
Positions the result to the last record 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.
Implementado en QMYSQLResult, QPSQLResult, SqliteResult, QtSqlCachedResult, QMYSQLResult, QODBCResult, QPSQLResult y QNullResult.
virtual bool QSqlResult::fetchLast | ( | ) | [protected, pure virtual] |
Implementado en QMYSQLResult, QPSQLResult, SqliteResult, QtSqlCachedResult, QMYSQLResult, QODBCResult, QPSQLResult y QNullResult.
bool QSqlResult::fetchNext | ( | ) | [protected, virtual] |
Positions the result to the next available record 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.
Reimplementado en QMYSQLResult, QtSqlCachedResult, QMYSQLResult y QODBCResult.
virtual bool QSqlResult::fetchNext | ( | ) | [protected, virtual] |
Reimplementado en QMYSQLResult, QtSqlCachedResult, QMYSQLResult y QODBCResult.
virtual bool QSqlResult::fetchPrev | ( | ) | [protected, virtual] |
Reimplementado en QtSqlCachedResult.
bool QSqlResult::fetchPrev | ( | ) | [protected, virtual] |
Positions the result to the previous available record 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.
Reimplementado en QtSqlCachedResult.
bool QSqlResult::isActive | ( | ) | const [protected] |
bool QSqlResult::isActive | ( | ) | const [protected] |
Returns TRUE if the result has records to be retrieved; otherwise returns FALSE.
bool QSqlResult::isForwardOnly | ( | ) | const [protected] |
bool QSqlResult::isForwardOnly | ( | ) | const [protected] |
Returns TRUE if you can only scroll forward through a result set; otherwise returns FALSE.
Returns TRUE if the field at position i is NULL; otherwise returns FALSE.
Implementado en QMYSQLResult, QPSQLResult, SqliteResult, QtSqlCachedResult, QMYSQLResult, QODBCResult, QPSQLResult y QNullResult.
Implementado en QMYSQLResult, QPSQLResult, SqliteResult, QtSqlCachedResult, QMYSQLResult, QODBCResult, QPSQLResult y QNullResult.
bool QSqlResult::isSelect | ( | ) | const [protected] |
Returns TRUE if the current result is from a SELECT statement; otherwise returns FALSE.
bool QSqlResult::isSelect | ( | ) | const [protected] |
bool QSqlResult::isValid | ( | ) | const [protected] |
bool QSqlResult::isValid | ( | void | ) | const [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.
QSqlError QSqlResult::lastError | ( | ) | const [protected] |
Returns the last error associated with the result.
QSqlError QSqlResult::lastError | ( | ) | const [protected] |
QString QSqlResult::lastQuery | ( | ) | const [protected] |
Returns the current SQL query text, or QString::null if there is none.
QString QSqlResult::lastQuery | ( | ) | const [protected] |
int QSqlResult::numRowsAffected | ( | ) | [protected, pure virtual] |
Returns the number of rows affected by the last query executed.
Implementado en QMYSQLResult, QPSQLResult, SqliteResult, QIBaseResult, QMYSQLResult, QODBCResult, QPSQLResult, QSQLiteResult y QNullResult.
virtual int QSqlResult::numRowsAffected | ( | ) | [protected, pure virtual] |
Implementado en QMYSQLResult, QPSQLResult, SqliteResult, QIBaseResult, QMYSQLResult, QODBCResult, QPSQLResult, QSQLiteResult y QNullResult.
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 called only 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.
Implementado en QMYSQLResult, QPSQLResult, SqliteResult, QIBaseResult, QMYSQLResult, QODBCResult, QPSQLResult, QSQLiteResult y QNullResult.
Implementado en QMYSQLResult, QPSQLResult, SqliteResult, QIBaseResult, QMYSQLResult, QODBCResult, QPSQLResult, QSQLiteResult y QNullResult.
virtual void QSqlResult::setActive | ( | bool | a | ) | [protected, virtual] |
void QSqlResult::setActive | ( | bool | a | ) | [protected, virtual] |
Protected function provided for derived classes to set the internal active state to the value of a.
virtual void QSqlResult::setAt | ( | int | at | ) | [protected, virtual] |
void QSqlResult::setAt | ( | int | at | ) | [protected, virtual] |
Protected function provided for derived classes to set the internal (zero-based) result index to at.
void QSqlResult::setExtension | ( | QSqlExtension * | ext | ) |
void QSqlResult::setExtension | ( | QSqlExtension * | ext | ) |
void QSqlResult::setForwardOnly | ( | bool | forward | ) | [protected, virtual] |
Sets forward only mode to forward. If forward is TRUE only fetchNext() is allowed for navigating the results. Forward only mode needs far less memory since results do not have to be cached. forward only mode is off by default.
virtual void QSqlResult::setForwardOnly | ( | bool | forward | ) | [protected, virtual] |
void QSqlResult::setLastError | ( | const QSqlError & | e | ) | [protected, virtual] |
Protected function provided for derived classes to set the last error to the value of e.
virtual void QSqlResult::setLastError | ( | const QSqlError & | e | ) | [protected, virtual] |
virtual void QSqlResult::setQuery | ( | const QString & | query | ) | [protected, virtual] |
void QSqlResult::setQuery | ( | const QString & | query | ) | [protected, virtual] |
Sets the current query for the result to query. The result must be reset() in order to execute the query on the database.
virtual void QSqlResult::setSelect | ( | bool | s | ) | [protected, virtual] |
void QSqlResult::setSelect | ( | bool | s | ) | [protected, virtual] |
Protected function 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, or FALSE otherwise.
int QSqlResult::size | ( | ) | [protected, pure virtual] |
Returns the size of the result or -1 if it cannot be determined.
Implementado en QMYSQLResult, QPSQLResult, SqliteResult, QIBaseResult, QMYSQLResult, QODBCResult, QPSQLResult, QSQLiteResult y QNullResult.
virtual int QSqlResult::size | ( | ) | [protected, pure virtual] |
Implementado en QMYSQLResult, QPSQLResult, SqliteResult, QIBaseResult, QMYSQLResult, QODBCResult, QPSQLResult, QSQLiteResult y QNullResult.
QSqlQuery [friend] |
QSqlResultShared [friend] |