.BI "virtual void \fBsetLastError\fR ( const QSqlError & e )"
.br
.in -1c
.SH DESCRIPTION
The QSqlDriver class is an abstract base class for accessing SQL databases.
.PP
This class should not be used directly. Use QSqlDatabase instead.
.PP
See also Database Classes.
.SS "Member Type Documentation"
.SH "QSqlDriver::DriverFeature"
This enum contains a list of features a driver may support. Use hasFeature() to query whether a feature is supported or not.
.TP
\fCQSqlDriver::Transactions\fR - whether the driver supports SQL transactions
.TP
\fCQSqlDriver::QuerySize\fR - 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
.TP
\fCQSqlDriver::BLOB\fR - whether the driver supports Binary Large Object fields
.TP
\fCQSqlDriver::Unicode\fR - whether the driver supports Unicode strings if the database server does
.TP
\fCQSqlDriver::PreparedQueries\fR - whether the driver supports prepared query execution
.TP
\fCQSqlDriver::NamedPlaceholders\fR - whether the driver supports usage of named placeholders
.TP
\fCQSqlDriver::PositionalPlaceholders\fR - whether the driver supports usage of positional placeholders
Protected function which derived classes can reimplement to begin a transaction. If successful, return TRUE, otherwise return FALSE. The default implementation returns FALSE.
.PP
See also commitTransaction() and rollbackTransaction().
Protected function which derived classes can reimplement to commit a transaction. If successful, return TRUE, otherwise return FALSE. The default implementation returns FALSE.
.PP
See also beginTransaction() and rollbackTransaction().
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.
Returns a string representation of the \fIfield\fR value for the database. This is used, for example, when constructing INSERT and UPDATE statements.
.PP
The default implementation returns the value formatted as a string according to the following rules:
.IP
.TP
If \fIfield\fR is NULL, nullText() is returned.
.IP
.TP
If \fIfield\fR 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 \fItrimStrings\fR is TRUE (the default is FALSE), all trailing whitespace is trimmed from the field.
.IP
.TP
If \fIfield\fR 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.
.IP
.TP
If \fIfield\fR is bytearray data, and the driver can edit binary fields, the value is formatted as a hexadecimal string.
.IP
.TP
For any other field type toString() will be called on its value and the result returned.
.IP
.PP
See also QVariant::toString().
.SH "bool QSqlDriver::hasFeature ( DriverFeature f ) const\fC [pure virtual]\fR"
Returns TRUE if the driver supports feature \fIf\fR; otherwise returns FALSE.
.PP
Note that some databases need to be open() before this can be determined.
.PP
See also DriverFeature.
.SH "bool QSqlDriver::isOpen () const"
Returns TRUE if the database connection is open; otherwise returns FALSE.
.SH "bool QSqlDriver::isOpenError () const"
Returns TRUE if the there was an error opening the database connection; otherwise returns FALSE.
.SH "QSqlError QSqlDriver::lastError () const"
Returns a QSqlError object which contains information about the last error that occurred on the database.
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".
Derived classes must reimplement this abstract virtual function in order to open a database connection on database \fIdb\fR, using user name \fIuser\fR, password \fIpassword\fR, host \fIhost\fR and port \fIport\fR.
.PP
The function \fImust\fR return TRUE on success and FALSE on failure.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Open a database connection on database \fIdb\fR, using user name \fIuser\fR, password \fIpassword\fR, host \fIhost\fR, port \fIport\fR and connection options \fIconnOpts\fR.
Returns the primary index for table \fItableName\fR. Returns an empty QSqlIndex if the table doesn't have a primary index. The default implementation returns an empty index.
Returns a QSqlRecord populated with the names of the fields in table \fItableName\fR. If no such table exists, an empty record is returned. The default implementation returns an empty record.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns a QSqlRecordInfo object with meta data for the QSqlQuery \fIquery\fR. Note that this overloaded function may return less information than the recordInfo() function which takes the name of a table as parameter.
Protected function which derived classes can reimplement to rollback a transaction. If successful, return TRUE, otherwise return FALSE. The default implementation returns FALSE.
.PP
See also beginTransaction() and commitTransaction().
Protected function which allows derived classes to set the value of the last error, \fIe\fR, that occurred on the database.
.PP
See also lastError().
.SH "void QSqlDriver::setOpen ( bool o )\fC [virtual protected]\fR"
Protected function which sets the open state of the database to \fIo\fR. Derived classes can use this function to report the status of open().
.PP
See also open() and setOpenError().
.SH "void QSqlDriver::setOpenError ( bool e )\fC [virtual protected]\fR"
Protected function which sets the open error state of the database to \fIe\fR. Derived classes can use this function to report the status of open(). Note that if \fIe\fR is TRUE the open state of the database is set to closed (i.e. isOpen() returns FALSE).
Returns a list of tables in the database. The default implementation returns an empty list.
.PP
The \fItableType\fR 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.