<class name="QSqlDriver" doc="/** <p>The <a href="QSqlDriver.html#QSqlDriver(com.trolltech.qt.core.QObject)"><tt>QSqlDriver</tt></a> class is an abstract base class for accessing specific SQL databases.</p> <p>This class should not be used directly. Use <a href="QSqlDatabase.html"><tt>QSqlDatabase</tt></a> instead.</p> <p>If you want to create your own SQL drivers, you can subclass this class and reimplement its pure virtual functions and those virtual functions that you need. See <a href="%2E%2E/sql-driver.html#how-to-write-your-own-database-driver">How to Write Your Own Database Driver</tt></a> for more information.</p> @see <a href="QSqlDatabase.html"><tt>QSqlDatabase</tt></a> @see <a href="QSqlResult.html"><tt>QSqlResult</tt></a> */"> <method name="public QSqlDriver(com.trolltech.qt.core.QObject parent)" doc="/** <p>Constructs a new driver with the given <tt>parent</tt>.</p> */"/> <method name="public QSqlDriver()" doc="/** <p>Equivalent to <a href="QSqlDriver.html#QSqlDriver(com.trolltech.qt.core.QObject)"><tt>QSqlDriver</tt></a>(0). */"/> <method name="public final boolean isOpenError()" doc="/** <p>Returns true if the there was an error opening the database connection; otherwise returns false.</p> */"/> <method name="public final com.trolltech.qt.sql.QSqlError lastError()" doc="/** <p>Returns a <a href="QSqlError.html"><tt>QSqlError</tt></a> object which contains information about the last error that occurred on the database.</p> @see <a href="QSqlDriver.html#setLastError(com.trolltech.qt.sql.QSqlError)"><tt>setLastError</tt></a> */"/> <method name="public boolean beginTransaction()" doc="/** <p>This function is called to begin a transaction. If successful, return true, otherwise return false. The default implementation does nothing and returns false.</p> @see <a href="QSqlDriver.html#commitTransaction()"><tt>commitTransaction</tt></a> @see <a href="QSqlDriver.html#rollbackTransaction()"><tt>rollbackTransaction</tt></a> */"/> <method name="public abstract void close()" doc="/** <p>Derived classes must reimplement this pure virtual function in order to close the database connection. Return true on success, false on failure.</p> @see <a href="QSqlDriver.html#open(java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String)"><tt>open</tt></a> @see <a href="QSqlDriver.html#setOpen(boolean)"><tt>setOpen</tt></a> */"/> <method name="public boolean commitTransaction()" doc="/** <p>This function is called to commit a transaction. If successful, return true, otherwise return false. The default implementation does nothing and returns false.</p> @see <a href="QSqlDriver.html#beginTransaction()"><tt>beginTransaction</tt></a> @see <a href="QSqlDriver.html#rollbackTransaction()"><tt>rollbackTransaction</tt></a> */"/> <method name="public abstract com.trolltech.qt.sql.QSqlResult createResult()" doc="/** <p>Creates an empty SQL result on the database. Derived classes must reimplement this function and return a <a href="QSqlResult.html"><tt>QSqlResult</tt></a> object appropriate for their database to the caller.</p> */"/> <method name="public java.lang.String escapeIdentifier(java.lang.String identifier, com.trolltech.qt.sql.QSqlDriver.IdentifierType type)" doc="/** <p>Returns the <tt>identifier</tt> escaped according to the database rules. <tt>identifier</tt> can either be a table name or field name, dependent on <tt>type</tt>.</p> <p>The default implementation does nothing.</p> */"/> <method name="public java.lang.String formatValue(com.trolltech.qt.sql.QSqlField field, boolean trimStrings)" doc="/** <p>Returns a string representation of the <tt>field</tt> value for the database. This is used, for example, when constructing INSERT and UPDATE statements.</p> <p>The default implementation returns the value formatted as a string according to the following rules:</p> <ul> <li>If <tt>field</tt> 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 <tt>trimStrings</tt> is true (the default is false), all trailing whitespace is trimmed from the field.</li> <li>If <tt>field</tt> is date/time data, the value is formatted in ISO format and enclosed in single quotation marks. If the date/time data is invalid, &quot;NULL&quot; is returned.</li> <li>If <tt>field</tt> is <a href="%2E%2E/core/QByteArray.html">bytearray</tt></a> data, and the driver can edit binary fields, the value is formatted as a hexadecimal string.</li> <li>For any other field type, toString() is called on its value and the result of this is returned.</li> </ul> @see <tt>QVariant::toString</tt> */"/> <method name="public final java.lang.String formatValue(com.trolltech.qt.sql.QSqlField field)" doc="/** <p>Equivalent to <a href="QSqlDriver.html#formatValue(com.trolltech.qt.sql.QSqlField, boolean)"><tt>formatValue</tt></a>(<tt>field</tt>, false). */"/> <method name="public java.lang.Object handle()" doc="/** <p>Returns the low-level database handle wrapped in a <a href="%2E%2E/porting4.html#qvariant"><tt>QVariant</tt></a> or an invalid variant if there is no handle.</p> <p><b>Warning:</b> Use this with uttermost care and only if you know what you're doing.</p> <p><b>Warning:</b> The handle returned here can become a stale pointer if the connection is modified (for example, if you close the connection).</p> <p><b>Warning:</b> The handle can be NULL if the connection is not open yet.</p> <p>The handle returned here is database-dependent, you should query the type name of the variant before accessing it.</p> <p>This example retrieves the handle for a connection to sqlite:</p> <pre> QSqlDatabase db = ...; QVariant v = db.driver()-&gt;handle(); if (v.isValid() &amp;&amp; v.typeName() == &quot;sqlite3*&quot;) { <span class="comment">// v.data() returns a pointer to the handle</span> sqlite3 *handle = *static_cast&lt;sqlite3 **&gt;(v.data()); if (handle != 0) { <span class="comment">// check that it is not NULL</span> ... } }</pre> <p>This snippet returns the handle for PostgreSQL or MySQL:</p> <pre> if (v.typeName() == &quot;PGconn*&quot;) { PGconn *handle = *static_cast&lt;PGconn **&gt;(v.data()); if (handle != 0) ... } if (v.typeName() == &quot;MYSQL*&quot;) { MYSQL *handle = *static_cast&lt;MYSQL **&gt;(v.data()); if (handle != 0) ... }</pre> @see <tt>QSqlResult::handle</tt> */"/> <method name="public abstract boolean hasFeature(com.trolltech.qt.sql.QSqlDriver.DriverFeature f)" doc="/** <p>Returns true if the driver supports feature <tt>f</tt>; otherwise returns false.</p> <p>Note that some databases need to be <a href="QSqlDriver.html#open(java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String)"><tt>open</tt></a> before this can be determined.</p> @see <a href="QSqlDriver.html#DriverFeature-enum"><tt>DriverFeature</tt></a> */"/> <method name="public boolean isOpen()" doc="/** <p>Returns true if the database connection is open; otherwise returns false.</p> */"/> <method name="public abstract boolean open(java.lang.String db, java.lang.String user, java.lang.String password, java.lang.String host, int port, java.lang.String connOpts)" doc="/** <p>Derived classes must reimplement this pure virtual function to open a database connection on database <tt>db</tt>, using user name <tt>user</tt>, password <tt>password</tt>, host <tt>host</tt>, port <tt>port</tt> and connection options <tt>connOpts</tt>.</p> <p>The function must return true on success and false on failure.</p> @see <a href="QSqlDriver.html#setOpen(boolean)"><tt>setOpen</tt></a> */"/> <method name="public final boolean open(java.lang.String db, java.lang.String user, java.lang.String password, java.lang.String host, int port)" doc="/** <p>Equivalent to <a href="QSqlDriver.html#open(java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String)">open</tt></a>(<tt>db</tt>, <tt>user</tt>, <tt>password</tt>, <tt>host</tt>, <tt>port</tt>, QString()). */"/> <method name="public final boolean open(java.lang.String db, java.lang.String user, java.lang.String password, java.lang.String host)" doc="/** <p>Equivalent to <a href="QSqlDriver.html#open(java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String)">open</tt></a>(<tt>db</tt>, <tt>user</tt>, <tt>password</tt>, <tt>host</tt>, -1, QString()). */"/> <method name="public final boolean open(java.lang.String db, java.lang.String user, java.lang.String password)" doc="/** <p>Equivalent to <a href="QSqlDriver.html#open(java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String)">open</tt></a>(<tt>db</tt>, <tt>user</tt>, <tt>password</tt>, QString(), -1, QString()). */"/> <method name="public final boolean open(java.lang.String db, java.lang.String user)" doc="/** <p>Equivalent to <a href="QSqlDriver.html#open(java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String)">open</tt></a>(<tt>db</tt>, <tt>user</tt>, QString(), QString(), -1, QString()). */"/> <method name="public final boolean open(java.lang.String db)" doc="/** <p>Equivalent to <a href="QSqlDriver.html#open(java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String)">open</tt></a>(<tt>db</tt>, QString(), QString(), QString(), -1, QString()). */"/> <method name="public com.trolltech.qt.sql.QSqlIndex primaryIndex(java.lang.String tableName)" doc="/** <p>Returns the primary index for table <tt>tableName</tt>. Returns an empty <a href="QSqlIndex.html"><tt>QSqlIndex</tt></a> if the table doesn't have a primary index. The default implementation returns an empty index.</p> */"/> <method name="public com.trolltech.qt.sql.QSqlRecord record(java.lang.String tableName)" doc="/** <p>Returns a <a href="QSqlRecord.html"><tt>QSqlRecord</tt></a> populated with the names of the fields in table <tt>tableName</tt>. If no such table exists, an empty record is returned. The default implementation returns an empty record.</p> */"/> <method name="public boolean rollbackTransaction()" doc="/** <p>This function is called to rollback a transaction. If successful, return true, otherwise return false. The default implementation does nothing and returns false.</p> @see <a href="QSqlDriver.html#beginTransaction()"><tt>beginTransaction</tt></a> @see <a href="QSqlDriver.html#commitTransaction()"><tt>commitTransaction</tt></a> */"/> <method name="protected void setLastError(com.trolltech.qt.sql.QSqlError e)" doc="/** <p>This function is used to set the value of the last error, <tt>e</tt>, that occurred on the database.</p> @see <a href="QSqlDriver.html#lastError()"><tt>lastError</tt></a> */"/> <method name="protected void setOpen(boolean o)" doc="/** <p>This function sets the open state of the database to <tt>o</tt>. Derived classes can use this function to report the status of <a href="QSqlDriver.html#open(java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String)"><tt>open</tt></a>.</p> @see <a href="QSqlDriver.html#open(java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String)"><tt>open</tt></a> @see <a href="QSqlDriver.html#setOpenError(boolean)"><tt>setOpenError</tt></a> */"/> <method name="protected void setOpenError(boolean e)" doc="/** <p>This function sets the open error state of the database to <tt>e</tt>. Derived classes can use this function to report the status of <a href="QSqlDriver.html#open(java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String)"><tt>open</tt></a>. Note that if <tt>e</tt> is true the open state of the database is set to closed (i.e&#x2e;, <a href="QSqlDriver.html#isOpen()"><tt>isOpen</tt></a> returns false).</p> @see <a href="QSqlDriver.html#isOpenError()"><tt>isOpenError</tt></a> @see <a href="QSqlDriver.html#open(java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String)"><tt>open</tt></a> @see <a href="QSqlDriver.html#setOpen(boolean)"><tt>setOpen</tt></a> */"/> <method name="public java.lang.String sqlStatement(com.trolltech.qt.sql.QSqlDriver.StatementType type, java.lang.String tableName, com.trolltech.qt.sql.QSqlRecord rec, boolean preparedStatement)" doc="/** <p>Returns a SQL statement of type <tt>type</tt> for the table <tt>tableName</tt> with the values from <tt>rec</tt>. If <tt>preparedStatement</tt> is true, the string will contain placeholders instead of values.</p> <p>This method can be used to manipulate tables without having to worry about database-dependent SQL dialects. For non-prepared statements, the values will be properly escaped.</p> */"/> <method name="public java.util.List<java.lang.String> tables(com.trolltech.qt.sql.QSql.TableType tableType)" doc="/** <p>Returns a list of the names of the tables in the database. The default implementation returns an empty list.</p> <p>The <tt>tableType</tt> 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 backward compatibility.</p> */"/> <enum name="StatementType" doc="/** <p>This enum contains a list of SQL statement (or clause) types the driver can create.</p> @see <a href="QSqlDriver.html#sqlStatement(com.trolltech.qt.sql.QSqlDriver.StatementType, java.lang.String, com.trolltech.qt.sql.QSqlRecord, boolean)"><tt>sqlStatement</tt></a> */"> <enum-value name="WhereStatement" doc="/** <p>An SQL <tt>WHERE</tt> statement (e.g&#x2e;, <tt>WHERE f = 5</tt>).</p> */"/> <enum-value name="SelectStatement" doc="/** <p>An SQL <tt>SELECT</tt> statement (e.g&#x2e;, <tt>SELECT f FROM t</tt>).</p> */"/> <enum-value name="UpdateStatement" doc="/** <p>An SQL <tt>UPDATE</tt> statement (e.g&#x2e;, <tt>UPDATE TABLE t set f = 1</tt>).</p> */"/> <enum-value name="InsertStatement" doc="/** <p>An SQL <tt>INSERT</tt> statement (e.g&#x2e;, <tt>INSERT INTO t (f) values (1)</tt>).</p> */"/> <enum-value name="DeleteStatement" doc="/** <p>An SQL <tt>DELETE</tt> statement (e.g&#x2e;, <tt>DELETE FROM t</tt>).</p> */"/> </enum> <enum name="IdentifierType" doc="/** <p>This enum contains a list of SQL identifier types.</p> */"> <enum-value name="FieldName" doc="/** <p>A SQL field name</p> */"/> <enum-value name="TableName" doc="/** <p>A SQL table name</p> */"/> </enum> <enum name="DriverFeature" doc="/** <p>This enum contains a list of features a driver might support. Use <a href="QSqlDriver.html#hasFeature(com.trolltech.qt.sql.QSqlDriver.DriverFeature)"><tt>hasFeature</tt></a> to query whether a feature is supported or not.</p> <p>More information about supported features can be found in the <a href="%2E%2E/sql-driver.html">Qt SQL driver</tt></a> documentation.</p> @see <a href="QSqlDriver.html#hasFeature(com.trolltech.qt.sql.QSqlDriver.DriverFeature)"><tt>hasFeature</tt></a> */"> <enum-value name="Transactions" doc="/** <p>Whether the driver supports SQL transactions.</p> */"/> <enum-value name="QuerySize" doc="/** <p>Whether the database is capable of reporting the size of a query. Note that some databases do not support returning the size (i.e&#x2e; number of rows returned) of a query, in which case QSqlQuery::size() will return -1.</p> */"/> <enum-value name="BLOB" doc="/** <p>Whether the driver supports Binary Large Object fields.</p> */"/> <enum-value name="Unicode" doc="/** <p>Whether the driver supports Unicode strings if the database server does.</p> */"/> <enum-value name="PreparedQueries" doc="/** <p>Whether the driver supports prepared query execution.</p> */"/> <enum-value name="NamedPlaceholders" doc="/** <p>Whether the driver supports the use of named placeholders.</p> */"/> <enum-value name="PositionalPlaceholders" doc="/** <p>Whether the driver supports the use of positional placeholders.</p> */"/> <enum-value name="LastInsertId" doc="/** <p>Whether the driver supports returning the Id of the last touched row.</p> */"/> <enum-value name="BatchOperations" doc="/** <p>Whether the driver supports batched operations, see QSqlResult::execBatch()</p> */"/> <enum-value name="SimpleLocking" doc="/** <p>Whether the driver disallows a write lock on a table while other queries have a read lock on it.</p> */"/> <enum-value name="LowPrecisionNumbers" doc="/** <p>Whether the driver allows fetching numerical values with low precision.</p> */"/> </enum> </class>