Eneboo - Documentación para desarrolladores
|
The QSqlDriver class is an abstract base class for accessing SQL databases. Más...
#include <qsqldriver.h>
The QSqlDriver class is an abstract base class for accessing SQL databases.
sql
This class should not be used directly. Use QSqlDatabase instead.
This enum contains a list of features a driver may support. Use hasFeature() to query whether a feature is supported or not.
Transactions whether the driver supports SQL transactions QuerySize whether the database is capable of reporting the size of a query. Note that some databases do not support returning the size (i.e. number of rows returned) of a query, in which case QSqlQuery::size() will return -1 BLOB whether the driver supports Binary Large Object fields Unicode whether the driver supports Unicode strings if the database server does PreparedQueries whether the driver supports prepared query execution NamedPlaceholders whether the driver supports usage of named placeholders PositionalPlaceholders whether the driver supports usage of positional placeholders
More information about supported features can be found in the Qt SQL driver documentation.
QSqlDriver::QSqlDriver | ( | QObject * | parent = 0 , |
const char * | name = 0 |
||
) |
Default constructor. Creates a new driver with parent parent, called name.
QSqlDriver::~QSqlDriver | ( | ) |
Destroys the object and frees any allocated resources.
QSqlDriver::QSqlDriver | ( | QObject * | parent = 0 , |
const char * | name = 0 |
||
) |
QSqlDriver::~QSqlDriver | ( | ) |
bool QSqlDriver::beginTransaction | ( | ) | [virtual] |
Protected function which derived classes can reimplement to begin a transaction. If successful, return TRUE, otherwise return FALSE. The default implementation returns FALSE.
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
virtual bool QSqlDriver::beginTransaction | ( | ) | [virtual] |
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
bool QSqlDriver::close | ( | void | ) | [pure virtual] |
Derived classes must reimplement this abstract virtual function in order to close the database connection. Return TRUE on success, FALSE on failure.
Implementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver, QSQLiteDriver y QNullDriver.
virtual void QSqlDriver::close | ( | ) | [pure virtual] |
Implementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver, QSQLiteDriver y QNullDriver.
bool QSqlDriver::commitTransaction | ( | ) | [virtual] |
Protected function which derived classes can reimplement to commit a transaction. If successful, return TRUE, otherwise return FALSE. The default implementation returns FALSE.
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
virtual bool QSqlDriver::commitTransaction | ( | ) | [virtual] |
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
QSqlQuery QSqlDriver::createQuery | ( | ) | const [pure virtual] |
Creates an empty SQL result on the database. Derived classes must reimplement this function and return a QSqlQuery object appropriate for their database to the caller.
Implementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver, QSQLiteDriver y QNullDriver.
virtual QSqlQuery QSqlDriver::createQuery | ( | ) | const [pure virtual] |
Implementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver, QSQLiteDriver y QNullDriver.
virtual QString QSqlDriver::formatValue | ( | const QSqlField * | field, |
bool | trimStrings = FALSE |
||
) | const [virtual] |
Reimplementado en QMYSQLDriver, QPSQLDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver y QPSQLDriver.
QString QSqlDriver::formatValue | ( | const QSqlField * | field, |
bool | trimStrings = FALSE |
||
) | const [virtual] |
Returns a string representation of the field value for the database. This is used, for example, when constructing INSERT and UPDATE statements.
The default implementation returns the value formatted as a string according to the following rules:
If field is NULL, nullText() is returned.
If field is character data, the value is returned enclosed in single quotation marks, which is appropriate for many SQL databases. Any embedded single-quote characters are escaped (replaced with two single-quote characters). If trimStrings is TRUE (the default is FALSE), all trailing whitespace is trimmed from the field.
If field is date/time data, the value is formatted in ISO format and enclosed in single quotation marks. If the date/time data is invalid, nullText() is returned.
If field is bytearray data, and the driver can edit binary fields, the value is formatted as a hexadecimal string.
For any other field type toString() will be called on its value and the result returned.
Reimplementado en QMYSQLDriver, QPSQLDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver y QPSQLDriver.
virtual bool QSqlDriver::hasFeature | ( | DriverFeature | f | ) | const [pure virtual] |
Implementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver, QSQLiteDriver y QNullDriver.
bool QSqlDriver::hasFeature | ( | DriverFeature | f | ) | const [pure virtual] |
Returns TRUE if the driver supports feature f; otherwise returns FALSE.
Note that some databases need to be open() before this can be determined.
Implementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver, QSQLiteDriver y QNullDriver.
bool QSqlDriver::isOpen | ( | ) | const |
bool QSqlDriver::isOpen | ( | ) | const |
Returns TRUE if the database connection is open; otherwise returns FALSE.
bool QSqlDriver::isOpenError | ( | ) | const |
Returns TRUE if the there was an error opening the database connection; otherwise returns FALSE.
bool QSqlDriver::isOpenError | ( | ) | const |
QSqlError QSqlDriver::lastError | ( | ) | const |
QSqlError QSqlDriver::lastError | ( | ) | const |
Returns a QSqlError object which contains information about the last error that occurred on the database.
virtual QString QSqlDriver::nullText | ( | ) | const [virtual] |
QString QSqlDriver::nullText | ( | ) | const [virtual] |
Returns a string representation of the NULL value for the database. This is used, for example, when constructing INSERT and UPDATE statements. The default implementation returns the string "NULL".
bool QSqlDriver::open | ( | const QString & | db, |
const QString & | user = QString::null , |
||
const QString & | password = QString::null , |
||
const QString & | host = QString::null , |
||
int | port = -1 |
||
) | [pure virtual] |
Derived classes must reimplement this abstract virtual function in order to open a database connection on database db, using user name user, password password, host host and port port.
The function must return TRUE on success and FALSE on failure.
Implementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver, QSQLiteDriver y QNullDriver.
virtual bool QSqlDriver::open | ( | const QString & | db, |
const QString & | user = QString::null , |
||
const QString & | password = QString::null , |
||
const QString & | host = QString::null , |
||
int | port = -1 |
||
) | [pure virtual] |
Implementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver, QSQLiteDriver y QNullDriver.
bool QSqlDriver::open | ( | const QString & | db, |
const QString & | user, | ||
const QString & | password, | ||
const QString & | host, | ||
int | port, | ||
const QString & | connOpts | ||
) |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Open a database connection on database db, using user name user, password password, host host, port port and connection options connOpts.
Returns TRUE on success and FALSE on failure.
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
bool QSqlDriver::open | ( | const QString & | db, |
const QString & | user, | ||
const QString & | password, | ||
const QString & | host, | ||
int | port, | ||
const QString & | connOpts | ||
) |
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
Returns the primary index for table tableName. Returns an empty QSqlIndex if the table doesn't have a primary index. The default implementation returns an empty index.
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
QSqlRecord QSqlDriver::record | ( | const QString & | tableName | ) | const [virtual] |
Returns a QSqlRecord populated with the names of the fields in table tableName. If no such table exists, an empty record is returned. The default implementation returns an empty record.
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
virtual QSqlRecord QSqlDriver::record | ( | const QSqlQuery & | query | ) | const [virtual] |
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
QSqlRecord QSqlDriver::record | ( | const QSqlQuery & | query | ) | const [virtual] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Returns a QSqlRecord populated with the names of the fields in the SQL query. The default implementation returns an empty record.
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
virtual QSqlRecord QSqlDriver::record | ( | const QString & | tableName | ) | const [virtual] |
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
virtual QSqlRecordInfo QSqlDriver::recordInfo | ( | const QSqlQuery & | query | ) | const [virtual] |
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
QSqlRecordInfo QSqlDriver::recordInfo | ( | const QSqlQuery & | query | ) | const [virtual] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Returns a QSqlRecordInfo object with meta data for the QSqlQuery query. Note that this overloaded function may return less information than the recordInfo() function which takes the name of a table as parameter.
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
QSqlRecordInfo QSqlDriver::recordInfo | ( | const QString & | tablename | ) | const [virtual] |
Returns a QSqlRecordInfo object with meta data about the table tablename.
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
virtual QSqlRecordInfo QSqlDriver::recordInfo | ( | const QString & | tablename | ) | const [virtual] |
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
bool QSqlDriver::rollbackTransaction | ( | ) | [virtual] |
Protected function which derived classes can reimplement to rollback a transaction. If successful, return TRUE, otherwise return FALSE. The default implementation returns FALSE.
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
virtual bool QSqlDriver::rollbackTransaction | ( | ) | [virtual] |
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
void QSqlDriver::setLastError | ( | const QSqlError & | e | ) | [protected, virtual] |
Protected function which allows derived classes to set the value of the last error, e, that occurred on the database.
virtual void QSqlDriver::setLastError | ( | const QSqlError & | e | ) | [protected, virtual] |
virtual void QSqlDriver::setOpen | ( | bool | o | ) | [protected, virtual] |
void QSqlDriver::setOpen | ( | bool | o | ) | [protected, virtual] |
Protected function which sets the open state of the database to o. Derived classes can use this function to report the status of open().
virtual void QSqlDriver::setOpenError | ( | bool | e | ) | [protected, virtual] |
void QSqlDriver::setOpenError | ( | bool | e | ) | [protected, virtual] |
Protected function which sets the open error state of the database to e. Derived classes can use this function to report the status of open(). Note that if e is TRUE the open state of the database is set to closed (i.e. isOpen() returns FALSE).
QStringList QSqlDriver::tables | ( | const QString & | tableType | ) | const [virtual] |
Returns a list of tables in the database. The default implementation returns an empty list.
The tableType argument describes what types of tables should be returned. Due to binary compatibility, the string contains the value of the enum QSql::TableTypes as text. An empty string should be treated as QSql::Tables for downward compatibility.
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
virtual QStringList QSqlDriver::tables | ( | const QString & | tableType | ) | const [virtual] |
Reimplementado en QMYSQLDriver, QPSQLDriver, SqliteDriver, QIBaseDriver, QMYSQLDriver, QODBCDriver, QPSQLDriver y QSQLiteDriver.
QSqlDatabase [friend] |