Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > a6711891ce757817bba854bf3f25205a > files > 2211

qtjambi-doc-4.3.3-3mdv2008.1.i586.rpm

<class name="QSqlQuery" doc="/**
&lt;p&gt;The &lt;a href=&quot;QSqlQuery.html#QSqlQuery(com.trolltech.qt.sql.QSqlDatabase)&quot;&gt;&lt;tt&gt;QSqlQuery&lt;/tt&gt;&lt;/a&gt; class provides a means of executing and manipulating SQL statements.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;QSqlQuery.html#QSqlQuery(com.trolltech.qt.sql.QSqlDatabase)&quot;&gt;&lt;tt&gt;QSqlQuery&lt;/tt&gt;&lt;/a&gt; encapsulates the functionality involved in creating, navigating and retrieving data from SQL queries which are executed on a &lt;a href=&quot;QSqlDatabase.html&quot;&gt;&lt;tt&gt;QSqlDatabase&lt;/tt&gt;&lt;/a&gt;. It can be used to execute DML (data manipulation language) statements, such as &lt;tt&gt;SELECT&lt;/tt&gt;, &lt;tt&gt;INSERT&lt;/tt&gt;, &lt;tt&gt;UPDATE&lt;/tt&gt; and &lt;tt&gt;DELETE&lt;/tt&gt;, as well as DDL (data definition language) statements, such as &lt;tt&gt;CREATE&lt;/tt&gt; &lt;tt&gt;TABLE&lt;/tt&gt;. It can also be used to execute database-specific commands which are not standard SQL (e.g&amp;#x2e; &lt;tt&gt;SET DATESTYLE=ISO&lt;/tt&gt; for PostgreSQL).&lt;/p&gt;
&lt;p&gt;Successfully executed SQL statements set the query's state to active; &lt;a href=&quot;QSqlQuery.html#isActive()&quot;&gt;&lt;tt&gt;isActive&lt;/tt&gt;&lt;/a&gt; then returns true. Otherwise the query's state is set to inactive. In either case, when executing a new SQL statement, the query is positioned on an invalid record; an active query must be navigated to a valid record (so that &lt;a href=&quot;QSqlQuery.html#isValid()&quot;&gt;&lt;tt&gt;isValid&lt;/tt&gt;&lt;/a&gt; returns true) before values can be retrieved.&lt;/p&gt;
&lt;a name=&quot;qsqlquery-examples&quot;&gt;&lt;/a&gt;&lt;p&gt;Navigating records is performed with the following functions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;QSqlQuery.html#next()&quot;&gt;&lt;tt&gt;next&lt;/tt&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;QSqlQuery.html#previous()&quot;&gt;&lt;tt&gt;previous&lt;/tt&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;QSqlQuery.html#first()&quot;&gt;&lt;tt&gt;first&lt;/tt&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;QSqlQuery.html#last()&quot;&gt;&lt;tt&gt;last&lt;/tt&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;QSqlQuery.html#seek(int, boolean)&quot;&gt;&lt;tt&gt;seek&lt;/tt&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These functions allow the programmer to move forward, backward or arbitrarily through the records returned by the query. If you only need to move forward through the results (e.g&amp;#x2e;, by using &lt;a href=&quot;QSqlQuery.html#next()&quot;&gt;&lt;tt&gt;next&lt;/tt&gt;&lt;/a&gt;), you can use &lt;a href=&quot;QSqlQuery.html#setForwardOnly(boolean)&quot;&gt;&lt;tt&gt;setForwardOnly&lt;/tt&gt;&lt;/a&gt;, which will save a significant amount of memory overhead and improve performance on some databases. Once an active query is positioned on a valid record, data can be retrieved using &lt;a href=&quot;QSqlQuery.html#value(int)&quot;&gt;&lt;tt&gt;value&lt;/tt&gt;&lt;/a&gt;. All data is transferred from the SQL backend using QVariants.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;pre&gt;        QSqlQuery query(&amp;quot;SELECT country FROM artist&amp;quot;);
        while (query.next()) {
            QString country = query.value(0).toString();
            doSomething(country);
        }&lt;/pre&gt;
&lt;p&gt;To access the data returned by a query, use value(int). Each field in the data returned by a &lt;tt&gt;SELECT&lt;/tt&gt; statement is accessed by passing the field's position in the statement, starting from 0. This makes using &lt;tt&gt;SELECT *&lt;/tt&gt; queries inadvisable because the order of the fields returned is indeterminate.&lt;/p&gt;
&lt;p&gt;For the sake of efficiency, there are no functions to access a field by name (unless you use prepared queries with names, as explained below). To convert a field name into an index, use &lt;a href=&quot;QSqlQuery.html#record()&quot;&gt;&lt;tt&gt;record&lt;/tt&gt;&lt;/a&gt;.indexOf(), for example:&lt;/p&gt;
&lt;pre&gt;        QSqlQuery query(&amp;quot;SELECT * FROM artist&amp;quot;);
        int fieldNo = query.record().indexOf(&amp;quot;country&amp;quot;);
        while (query.next()) {
            QString country = query.value(fieldNo).toString();
            doSomething(country);
        }&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;QSqlQuery.html#QSqlQuery(com.trolltech.qt.sql.QSqlDatabase)&quot;&gt;&lt;tt&gt;QSqlQuery&lt;/tt&gt;&lt;/a&gt; supports prepared query execution and the binding of parameter values to placeholders. Some databases don't support these features, so for those, Qt emulates the required functionality. For example, the Oracle and ODBC drivers have proper prepared query support, and Qt makes use of it; but for databases that don't have this support, Qt implements the feature itself, e.g&amp;#x2e; by replacing placeholders with actual values when a query is executed. Use &lt;a href=&quot;QSqlQuery.html#numRowsAffected()&quot;&gt;&lt;tt&gt;numRowsAffected&lt;/tt&gt;&lt;/a&gt; to find out how many rows were affected by a non-&lt;tt&gt;SELECT&lt;/tt&gt; query, and &lt;a href=&quot;QSqlQuery.html#size()&quot;&gt;&lt;tt&gt;size&lt;/tt&gt;&lt;/a&gt; to find how many were retrieved by a &lt;tt&gt;SELECT&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;Oracle databases identify placeholders by using a colon-name syntax, e.g &lt;tt&gt;:name&lt;/tt&gt;. ODBC simply uses &lt;tt&gt;?&lt;/tt&gt; characters. Qt supports both syntaxes, with the restriction that you can't mix them in the same query.&lt;/p&gt;
&lt;p&gt;You can retrieve the values of all the fields in a single variable (a map) using &lt;a href=&quot;QSqlQuery.html#boundValues()&quot;&gt;&lt;tt&gt;boundValues&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;a name=&quot;approaches-to-binding-values&quot;&gt;&lt;/a&gt;
&lt;h3&gt;Approaches to Binding Values&lt;/h3&gt;
&lt;p&gt;Below we present the same example using each of the four different binding approaches, as well as one example of binding values to a stored procedure.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Named binding using named placeholders:&lt;/b&gt;&lt;/p&gt;
&lt;pre&gt;        QSqlQuery query;
        query.prepare(&amp;quot;INSERT INTO person (id, forename, surname) &amp;quot;
                      &amp;quot;VALUES (:id, :forename, :surname)&amp;quot;);
        query.bindValue(&amp;quot;:id&amp;quot;, 1001);
        query.bindValue(&amp;quot;:forename&amp;quot;, &amp;quot;Bart&amp;quot;);
        query.bindValue(&amp;quot;:surname&amp;quot;, &amp;quot;Simpson&amp;quot;);
        query.exec();&lt;/pre&gt;
&lt;p&gt;&lt;b&gt;Positional binding using named placeholders:&lt;/b&gt;&lt;/p&gt;
&lt;pre&gt;        QSqlQuery query;
        query.prepare(&amp;quot;INSERT INTO person (id, forename, surname) &amp;quot;
                      &amp;quot;VALUES (:id, :forename, :surname)&amp;quot;);
        query.bindValue(0, 1001);
        query.bindValue(1, &amp;quot;Bart&amp;quot;);
        query.bindValue(2, &amp;quot;Simpson&amp;quot;);
        query.exec();&lt;/pre&gt;
&lt;p&gt;&lt;b&gt;Binding values using positional placeholders (version 1):&lt;/b&gt;&lt;/p&gt;
&lt;pre&gt;        QSqlQuery query;
        query.prepare(&amp;quot;INSERT INTO person (id, forename, surname) &amp;quot;
                      &amp;quot;VALUES (?, ?, ?)&amp;quot;);
        query.bindValue(0, 1001);
        query.bindValue(1, &amp;quot;Bart&amp;quot;);
        query.bindValue(2, &amp;quot;Simpson&amp;quot;);
        query.exec();&lt;/pre&gt;
&lt;p&gt;&lt;b&gt;Binding values using positional placeholders (version 2):&lt;/b&gt;&lt;/p&gt;
&lt;pre&gt;        QSqlQuery query;
        query.prepare(&amp;quot;INSERT INTO person (id, forename, surname) &amp;quot;
                      &amp;quot;VALUES (?, ?, ?)&amp;quot;);
        query.addBindValue(1001);
        query.addBindValue(&amp;quot;Bart&amp;quot;);
        query.addBindValue(&amp;quot;Simpson&amp;quot;);
        query.exec();&lt;/pre&gt;
&lt;p&gt;&lt;b&gt;Binding values to a stored procedure:&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;This code calls a stored procedure called &lt;tt&gt;AsciiToInt()&lt;/tt&gt;, passing it a character through its in parameter, and taking its result in the out parameter.&lt;/p&gt;
&lt;pre&gt;        QSqlQuery query;
        query.prepare(&amp;quot;CALL AsciiToInt(?, ?)&amp;quot;);
        query.bindValue(0, &amp;quot;A&amp;quot;);
        query.bindValue(1, 0, QSql::Out);
        query.exec();
        int i = query.boundValue(1).toInt(); &lt;span class=&quot;comment&quot;&gt;// i is 65&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Note that unbound parameters will retain their values.&lt;/p&gt;
&lt;p&gt;Stored procedures that uses the return statement to return values, or return multiple result sets, are not fully supported. For specific details see &lt;a href=&quot;%2E%2E/sql-driver.html&quot;&gt;SQL Database Drivers&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Warning:&lt;/b&gt; You must load the SQL driver and open the connection before a &lt;a href=&quot;QSqlQuery.html#QSqlQuery(com.trolltech.qt.sql.QSqlDatabase)&quot;&gt;&lt;tt&gt;QSqlQuery&lt;/tt&gt;&lt;/a&gt; is created. Also, the connection must remain open while the query exists; otherwise, the behavior of &lt;a href=&quot;QSqlQuery.html#QSqlQuery(com.trolltech.qt.sql.QSqlDatabase)&quot;&gt;&lt;tt&gt;QSqlQuery&lt;/tt&gt;&lt;/a&gt; is undefined.&lt;/p&gt;

@see &lt;a href=&quot;QSqlDatabase.html&quot;&gt;&lt;tt&gt;QSqlDatabase&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQueryModel.html&quot;&gt;&lt;tt&gt;QSqlQueryModel&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlTableModel.html&quot;&gt;&lt;tt&gt;QSqlTableModel&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;%2E%2E/porting4.html#qvariant&quot;&gt;&lt;tt&gt;QVariant&lt;/tt&gt;&lt;/a&gt; */">
    <method name="public QSqlQuery(java.lang.String query, com.trolltech.qt.sql.QSqlDatabase db)" doc="/**
&lt;p&gt;Constructs a &lt;a href=&quot;QSqlQuery.html#QSqlQuery(com.trolltech.qt.sql.QSqlDatabase)&quot;&gt;&lt;tt&gt;QSqlQuery&lt;/tt&gt;&lt;/a&gt; object using the SQL &lt;tt&gt;query&lt;/tt&gt; and the database &lt;tt&gt;db&lt;/tt&gt;. If &lt;tt&gt;db&lt;/tt&gt; is not specified, the application's default database is used. If &lt;tt&gt;query&lt;/tt&gt; is not an empty string, it will be executed.&lt;/p&gt;

@see &lt;a href=&quot;QSqlDatabase.html&quot;&gt;&lt;tt&gt;QSqlDatabase&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public QSqlQuery(java.lang.String query)" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QSqlQuery.html#QSqlQuery(com.trolltech.qt.sql.QSqlDatabase)&quot;&gt;&lt;tt&gt;QSqlQuery&lt;/tt&gt;&lt;/a&gt;(&lt;tt&gt;query&lt;/tt&gt;, QSqlDatabase()). */"/>
    <method name="public QSqlQuery()" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QSqlQuery.html#QSqlQuery(com.trolltech.qt.sql.QSqlDatabase)&quot;&gt;&lt;tt&gt;QSqlQuery&lt;/tt&gt;&lt;/a&gt;(QString(), QSqlDatabase()). */"/>
    <method name="public QSqlQuery(com.trolltech.qt.sql.QSqlQuery other)" doc="/**
&lt;p&gt;Constructs a copy of &lt;tt&gt;other&lt;/tt&gt;.&lt;/p&gt;
 */"/>
    <method name="public QSqlQuery(com.trolltech.qt.sql.QSqlResult r)" doc="/**
&lt;p&gt;Constructs a &lt;a href=&quot;QSqlQuery.html#QSqlQuery(com.trolltech.qt.sql.QSqlDatabase)&quot;&gt;&lt;tt&gt;QSqlQuery&lt;/tt&gt;&lt;/a&gt; object which uses the &lt;a href=&quot;QSqlResult.html&quot;&gt;&lt;tt&gt;QSqlResult&lt;/tt&gt;&lt;/a&gt; &lt;tt&gt;r&lt;/tt&gt; to communicate with a database.&lt;/p&gt;
 */"/>
    <method name="public QSqlQuery(com.trolltech.qt.sql.QSqlDatabase db)" doc="/**
&lt;p&gt;Constructs a &lt;a href=&quot;QSqlQuery.html#QSqlQuery(com.trolltech.qt.sql.QSqlDatabase)&quot;&gt;&lt;tt&gt;QSqlQuery&lt;/tt&gt;&lt;/a&gt; object using the database &lt;tt&gt;db&lt;/tt&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QSqlDatabase.html&quot;&gt;&lt;tt&gt;QSqlDatabase&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void addBindValue(java.lang.Object val, com.trolltech.qt.sql.QSql.ParamType type)" doc="/**
&lt;p&gt;Adds the value &lt;tt&gt;val&lt;/tt&gt; to the list of values when using positional value binding. The order of the &lt;a href=&quot;QSqlQuery.html#addBindValue(java.lang.Object, com.trolltech.qt.sql.QSql.ParamType)&quot;&gt;&lt;tt&gt;addBindValue&lt;/tt&gt;&lt;/a&gt; calls determines which placeholder a value will be bound to in the prepared query. If &lt;tt&gt;type&lt;/tt&gt; is QSql::Out or QSql::InOut, the placeholder will be overwritten with data from the database after the &lt;a href=&quot;QSqlQuery.html#exec()&quot;&gt;&lt;tt&gt;exec&lt;/tt&gt;&lt;/a&gt; call.&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#bindValue(java.lang.String, java.lang.Object, com.trolltech.qt.sql.QSql.ParamType)&quot;&gt;&lt;tt&gt;bindValue&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#prepare(java.lang.String)&quot;&gt;&lt;tt&gt;prepare&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#exec()&quot;&gt;&lt;tt&gt;exec&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#boundValue(java.lang.String)&quot;&gt;&lt;tt&gt;boundValue&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#boundValues()&quot;&gt;&lt;tt&gt;boundValues&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void addBindValue(java.lang.Object val)" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QSqlQuery.html#addBindValue(java.lang.Object, com.trolltech.qt.sql.QSql.ParamType)&quot;&gt;&lt;tt&gt;addBindValue&lt;/tt&gt;&lt;/a&gt;(&lt;tt&gt;val&lt;/tt&gt;, QSql::In). */"/>
    <method name="public final int at()" doc="/**
&lt;p&gt;Returns the current internal position of the query. The first record is at position zero. If the position is invalid, the function returns QSql::BeforeFirstRow or QSql::AfterLastRow, which are special negative values.&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#previous()&quot;&gt;&lt;tt&gt;previous&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#next()&quot;&gt;&lt;tt&gt;next&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#first()&quot;&gt;&lt;tt&gt;first&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#last()&quot;&gt;&lt;tt&gt;last&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#seek(int, boolean)&quot;&gt;&lt;tt&gt;seek&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#isActive()&quot;&gt;&lt;tt&gt;isActive&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#isValid()&quot;&gt;&lt;tt&gt;isValid&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void bindValue(int pos, java.lang.Object val, com.trolltech.qt.sql.QSql.ParamType type)" doc="/**
&lt;p&gt;Set the placeholder in position &lt;tt&gt;pos&lt;/tt&gt; to be bound to value &lt;tt&gt;val&lt;/tt&gt; in the prepared statement. Field numbering starts at 0. If &lt;tt&gt;type&lt;/tt&gt; is QSql::Out or QSql::InOut, the placeholder will be overwritten with data from the database after the &lt;a href=&quot;QSqlQuery.html#exec()&quot;&gt;&lt;tt&gt;exec&lt;/tt&gt;&lt;/a&gt; call.&lt;/p&gt;
 */"/>
    <method name="public final void bindValue(int pos, java.lang.Object val)" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QSqlQuery.html#bindValue(java.lang.String, java.lang.Object, com.trolltech.qt.sql.QSql.ParamType)&quot;&gt;&lt;tt&gt;bindValue&lt;/tt&gt;&lt;/a&gt;(&lt;tt&gt;pos&lt;/tt&gt;, &lt;tt&gt;val&lt;/tt&gt;, QSql::In). */"/>
    <method name="public final void bindValue(java.lang.String placeholder, java.lang.Object val, com.trolltech.qt.sql.QSql.ParamType type)" doc="/**
&lt;p&gt;Set the placeholder &lt;tt&gt;placeholder&lt;/tt&gt; to be bound to value &lt;tt&gt;val&lt;/tt&gt; in the prepared statement. Note that the placeholder mark (e.g &lt;tt&gt;:&lt;/tt&gt;) must be included when specifying the placeholder name. If &lt;tt&gt;type&lt;/tt&gt; is QSql::Out or QSql::InOut, the placeholder will be overwritten with data from the database after the &lt;a href=&quot;QSqlQuery.html#exec()&quot;&gt;&lt;tt&gt;exec&lt;/tt&gt;&lt;/a&gt; call.&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#addBindValue(java.lang.Object, com.trolltech.qt.sql.QSql.ParamType)&quot;&gt;&lt;tt&gt;addBindValue&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#prepare(java.lang.String)&quot;&gt;&lt;tt&gt;prepare&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#exec()&quot;&gt;&lt;tt&gt;exec&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#boundValue(java.lang.String)&quot;&gt;&lt;tt&gt;boundValue&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#boundValues()&quot;&gt;&lt;tt&gt;boundValues&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void bindValue(java.lang.String placeholder, java.lang.Object val)" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QSqlQuery.html#bindValue(java.lang.String, java.lang.Object, com.trolltech.qt.sql.QSql.ParamType)&quot;&gt;&lt;tt&gt;bindValue&lt;/tt&gt;&lt;/a&gt;(&lt;tt&gt;placeholder&lt;/tt&gt;, &lt;tt&gt;val&lt;/tt&gt;, QSql::In). */"/>
    <method name="public final java.lang.Object boundValue(int pos)" doc="/**
&lt;p&gt;Returns the value for the placeholder at position &lt;tt&gt;pos&lt;/tt&gt;.&lt;/p&gt;
 */"/>
    <method name="public final java.lang.Object boundValue(java.lang.String placeholder)" doc="/**
&lt;p&gt;Returns the value for the &lt;tt&gt;placeholder&lt;/tt&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#boundValues()&quot;&gt;&lt;tt&gt;boundValues&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#bindValue(java.lang.String, java.lang.Object, com.trolltech.qt.sql.QSql.ParamType)&quot;&gt;&lt;tt&gt;bindValue&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#addBindValue(java.lang.Object, com.trolltech.qt.sql.QSql.ParamType)&quot;&gt;&lt;tt&gt;addBindValue&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final java.util.SortedMap&lt;java.lang.String, java.lang.Object&gt; boundValues()" doc="/**
&lt;p&gt;Returns a map of the bound values.&lt;/p&gt;
&lt;p&gt;With named binding, the bound values can be examined in the following ways:&lt;/p&gt;
&lt;pre&gt;        QMapIterator&amp;lt;QString, QVariant&amp;gt; i(query.boundValues());
        while (i.hasNext()) {
            i.next();
            cout &amp;lt;&amp;lt; i.key().toAscii().data() &amp;lt;&amp;lt; &amp;quot;: &amp;quot;
                 &amp;lt;&amp;lt; i.value().toString().toAscii().data() &amp;lt;&amp;lt; endl;
        }&lt;/pre&gt;
&lt;p&gt;With positional binding, the code becomes:&lt;/p&gt;
&lt;pre&gt;        QList&amp;lt;QVariant&amp;gt; list = query.boundValues().values();
        for (int i = 0; i &amp;lt; list.size(); ++i)
            cout &amp;lt;&amp;lt; i &amp;lt;&amp;lt; &amp;quot;: &amp;quot; &amp;lt;&amp;lt; list.at(i).toString().toAscii().data() &amp;lt;&amp;lt; endl;&lt;/pre&gt;

@see &lt;a href=&quot;QSqlQuery.html#boundValue(java.lang.String)&quot;&gt;&lt;tt&gt;boundValue&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#bindValue(java.lang.String, java.lang.Object, com.trolltech.qt.sql.QSql.ParamType)&quot;&gt;&lt;tt&gt;bindValue&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#addBindValue(java.lang.Object, com.trolltech.qt.sql.QSql.ParamType)&quot;&gt;&lt;tt&gt;addBindValue&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void clear()" doc="/**
&lt;p&gt;Clears the result set and releases any resources held by the query. You should rarely if ever need to call this function.&lt;/p&gt;
 */"/>
    <method name="public final com.trolltech.qt.sql.QSqlDriver driver()" doc="/**
&lt;p&gt;Returns the database driver associated with the query.&lt;/p&gt;
 */"/>
    <method name="public final boolean exec(java.lang.String query)" doc="/**
&lt;p&gt;Executes the SQL in &lt;tt&gt;query&lt;/tt&gt;. Returns true and sets the query state to active if the query was successful; otherwise returns false. The &lt;tt&gt;query&lt;/tt&gt; string must use syntax appropriate for the SQL database being queried (for example, standard SQL).&lt;/p&gt;
&lt;p&gt;After the query is executed, the query is positioned on an &lt;i&gt;invalid&lt;/i&gt; record and must be navigated to a valid record before data values can be retrieved (for example, using &lt;a href=&quot;QSqlQuery.html#next()&quot;&gt;&lt;tt&gt;next&lt;/tt&gt;&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Note that the last error for this query is reset when &lt;a href=&quot;QSqlQuery.html#exec()&quot;&gt;&lt;tt&gt;exec&lt;/tt&gt;&lt;/a&gt; is called.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre&gt;        QSqlQuery query;
        query.prepare(&amp;quot;INSERT INTO person (id, forename, surname) &amp;quot;
                      &amp;quot;VALUES (:id, :forename, :surname)&amp;quot;);
        query.bindValue(&amp;quot;:id&amp;quot;, 1001);
        query.bindValue(&amp;quot;:forename&amp;quot;, &amp;quot;Bart&amp;quot;);
        query.bindValue(&amp;quot;:surname&amp;quot;, &amp;quot;Simpson&amp;quot;);
        query.exec();&lt;/pre&gt;

@see &lt;a href=&quot;QSqlQuery.html#isActive()&quot;&gt;&lt;tt&gt;isActive&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#isValid()&quot;&gt;&lt;tt&gt;isValid&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#next()&quot;&gt;&lt;tt&gt;next&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#previous()&quot;&gt;&lt;tt&gt;previous&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#first()&quot;&gt;&lt;tt&gt;first&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#last()&quot;&gt;&lt;tt&gt;last&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#seek(int, boolean)&quot;&gt;&lt;tt&gt;seek&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean exec()" doc="/**
&lt;p&gt;Executes a previously prepared SQL query. Returns true if the query executed successfully; otherwise returns false.&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#prepare(java.lang.String)&quot;&gt;&lt;tt&gt;prepare&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#bindValue(java.lang.String, java.lang.Object, com.trolltech.qt.sql.QSql.ParamType)&quot;&gt;&lt;tt&gt;bindValue&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#addBindValue(java.lang.Object, com.trolltech.qt.sql.QSql.ParamType)&quot;&gt;&lt;tt&gt;addBindValue&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#boundValue(java.lang.String)&quot;&gt;&lt;tt&gt;boundValue&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#boundValues()&quot;&gt;&lt;tt&gt;boundValues&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean execBatch(com.trolltech.qt.sql.QSqlQuery.BatchExecutionMode mode)" doc="/**
&lt;p&gt;Executes a previously prepared SQL query in a batch. All the bound parameters have to be lists of variants. If the database doesn't support batch executions, the driver will simulate it using conventional &lt;a href=&quot;QSqlQuery.html#exec()&quot;&gt;&lt;tt&gt;exec&lt;/tt&gt;&lt;/a&gt; calls.&lt;/p&gt;
&lt;p&gt;Returns true if the query is executed successfully; otherwise returns false.&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre&gt;    QSqlQuery q;
    q.prepare(&amp;quot;insert into myTable values (?, ?)&amp;quot;);

    QVariantList ints;
    ints &amp;lt;&amp;lt; 1 &amp;lt;&amp;lt; 2 &amp;lt;&amp;lt; 3 &amp;lt;&amp;lt; 4;
    q.addBindValue(ints);

    QVariantList names;
    names &amp;lt;&amp;lt; &amp;quot;Harald&amp;quot; &amp;lt;&amp;lt; &amp;quot;Boris&amp;quot; &amp;lt;&amp;lt; &amp;quot;Trond&amp;quot; &amp;lt;&amp;lt; QVariant(QVariant::String);
    q.addBindValue(names);

    if (!q.execBatch())
        qDebug() &amp;lt;&amp;lt; q.lastError();&lt;/pre&gt;
&lt;p&gt;The example above inserts four new rows into &lt;tt&gt;myTable&lt;/tt&gt;:&lt;/p&gt;
&lt;pre&gt;    1  Harald
    2  Boris
    3  Trond
    4  NULL&lt;/pre&gt;
&lt;p&gt;To bind NULL values, a null &lt;a href=&quot;%2E%2E/porting4.html#qvariant&quot;&gt;&lt;tt&gt;QVariant&lt;/tt&gt;&lt;/a&gt; has to be added to the bound QVariantList, for example: &lt;tt&gt;QVariant(QVariant::String)&lt;/tt&gt;&lt;/p&gt;
&lt;p&gt;Note that every bound QVariantList must contain the same amount of variants. Note that the type of the QVariants in a list must not change. For example, you cannot mix integer and string variants within a QVariantList.&lt;/p&gt;
&lt;p&gt;The &lt;tt&gt;mode&lt;/tt&gt; parameter indicates how the bound QVariantList will be interpreted. If &lt;tt&gt;mode&lt;/tt&gt; is &lt;tt&gt;ValuesAsRows&lt;/tt&gt;, every variant within the QVariantList will be interpreted as a value for a new row. &lt;tt&gt;ValuesAsColumns&lt;/tt&gt; is a special case for the Oracle driver. In this mode, every entry within a QVariantList will be interpreted as array-value for an IN or OUT value within a stored procedure. Note that this will only work if the IN or OUT value is a table-type consisting of only one column of a basic type, for example &lt;tt&gt;TYPE myType IS TABLE OF VARCHAR(64) INDEX BY BINARY_INTEGER;&lt;/tt&gt;&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#prepare(java.lang.String)&quot;&gt;&lt;tt&gt;prepare&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#bindValue(java.lang.String, java.lang.Object, com.trolltech.qt.sql.QSql.ParamType)&quot;&gt;&lt;tt&gt;bindValue&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#addBindValue(java.lang.Object, com.trolltech.qt.sql.QSql.ParamType)&quot;&gt;&lt;tt&gt;addBindValue&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean execBatch()" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QSqlQuery.html#execBatch(com.trolltech.qt.sql.QSqlQuery.BatchExecutionMode)&quot;&gt;&lt;tt&gt;execBatch&lt;/tt&gt;&lt;/a&gt;(ValuesAsRows). */"/>
    <method name="public final java.lang.String executedQuery()" doc="/**
&lt;p&gt;Returns the last query that was executed.&lt;/p&gt;
&lt;p&gt;In most cases this function returns the same string as &lt;a href=&quot;QSqlQuery.html#lastQuery()&quot;&gt;&lt;tt&gt;lastQuery&lt;/tt&gt;&lt;/a&gt;. If a prepared query with placeholders is executed on a DBMS that does not support it, the preparation of this query is emulated. The placeholders in the original query are replaced with their bound values to form a new query. This function returns the modified query. It is mostly useful for debugging purposes.&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#lastQuery()&quot;&gt;&lt;tt&gt;lastQuery&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean first()" doc="/**
&lt;p&gt;Retrieves the first record in the result, if available, and positions the query on the retrieved record. Note that the result must be in an active state and &lt;a href=&quot;QSqlQuery.html#isSelect()&quot;&gt;&lt;tt&gt;isSelect&lt;/tt&gt;&lt;/a&gt; must return true before calling this function or it will do nothing and return false. Returns true if successful. If unsuccessful the query position is set to an invalid position and false is returned.&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#next()&quot;&gt;&lt;tt&gt;next&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#previous()&quot;&gt;&lt;tt&gt;previous&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#last()&quot;&gt;&lt;tt&gt;last&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#seek(int, boolean)&quot;&gt;&lt;tt&gt;seek&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#at()&quot;&gt;&lt;tt&gt;at&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#isActive()&quot;&gt;&lt;tt&gt;isActive&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#isValid()&quot;&gt;&lt;tt&gt;isValid&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean isActive()" doc="/**
&lt;p&gt;Returns true if the query is currently active; otherwise returns false.&lt;/p&gt;
 */"/>
    <method name="public final boolean isForwardOnly()" doc="/**
&lt;p&gt;Returns true if you can only scroll forward through a result set; otherwise returns false.&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#setForwardOnly(boolean)&quot;&gt;&lt;tt&gt;setForwardOnly&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#next()&quot;&gt;&lt;tt&gt;next&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean isNull(int field)" doc="/**
&lt;p&gt;Returns true if the query is active and positioned on a valid record and the &lt;tt&gt;field&lt;/tt&gt; is NULL; otherwise returns false. Note that for some drivers, &lt;a href=&quot;QSqlQuery.html#isNull(int)&quot;&gt;&lt;tt&gt;isNull&lt;/tt&gt;&lt;/a&gt; will not return accurate information until after an attempt is made to retrieve data.&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#isActive()&quot;&gt;&lt;tt&gt;isActive&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#isValid()&quot;&gt;&lt;tt&gt;isValid&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#value(int)&quot;&gt;&lt;tt&gt;value&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean isSelect()" doc="/**
&lt;p&gt;Returns true if the current query is a &lt;tt&gt;SELECT&lt;/tt&gt; statement; otherwise returns false.&lt;/p&gt;
 */"/>
    <method name="public final boolean isValid()" doc="/**
&lt;p&gt;Returns true if the query is currently positioned on a valid record; otherwise returns false.&lt;/p&gt;
 */"/>
    <method name="public final boolean last()" doc="/**
&lt;p&gt;Retrieves the last record in the result, if available, and positions the query on the retrieved record. Note that the result must be in an active state and &lt;a href=&quot;QSqlQuery.html#isSelect()&quot;&gt;&lt;tt&gt;isSelect&lt;/tt&gt;&lt;/a&gt; must return true before calling this function or it will do nothing and return false. Returns true if successful. If unsuccessful the query position is set to an invalid position and false is returned.&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#next()&quot;&gt;&lt;tt&gt;next&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#previous()&quot;&gt;&lt;tt&gt;previous&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#first()&quot;&gt;&lt;tt&gt;first&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#seek(int, boolean)&quot;&gt;&lt;tt&gt;seek&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#at()&quot;&gt;&lt;tt&gt;at&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#isActive()&quot;&gt;&lt;tt&gt;isActive&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#isValid()&quot;&gt;&lt;tt&gt;isValid&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final com.trolltech.qt.sql.QSqlError lastError()" doc="/**
&lt;p&gt;Returns error information about the last error (if any) that occurred with this query.&lt;/p&gt;

@see &lt;a href=&quot;QSqlError.html&quot;&gt;&lt;tt&gt;QSqlError&lt;/tt&gt;&lt;/a&gt;
@see &lt;tt&gt;QSqlDatabase::lastError&lt;/tt&gt; */"/>
    <method name="public final java.lang.Object lastInsertId()" doc="/**
&lt;p&gt;Returns the object ID of the most recent inserted row if the database supports it. An invalid &lt;a href=&quot;%2E%2E/porting4.html#qvariant&quot;&gt;&lt;tt&gt;QVariant&lt;/tt&gt;&lt;/a&gt; will be returned if the query did not insert any value or if the database does not report the id back. If more than one row was touched by the insert, the behavior is undefined.&lt;/p&gt;
&lt;p&gt;Note that for Oracle databases the row's ROWID will be returned, while for MySQL databases the row's auto-increment field will be returned.&lt;/p&gt;

@see &lt;tt&gt;QSqlDriver::hasFeature&lt;/tt&gt; */"/>
    <method name="public final java.lang.String lastQuery()" doc="/**
&lt;p&gt;Returns the text of the current query being used, or an empty string if there is no current query text.&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#executedQuery()&quot;&gt;&lt;tt&gt;executedQuery&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean next()" doc="/**
&lt;p&gt;Retrieves the next record in the result, if available, and positions the query on the retrieved record. Note that the result must be in an active state and &lt;a href=&quot;QSqlQuery.html#isSelect()&quot;&gt;&lt;tt&gt;isSelect&lt;/tt&gt;&lt;/a&gt; must return true before calling this function or it will do nothing and return false.&lt;/p&gt;
&lt;p&gt;The following rules apply:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If the result is currently located before the first record, e.g&amp;#x2e; immediately after a query is executed, an attempt is made to retrieve the first record.&lt;/li&gt;
&lt;li&gt;If the result is currently located after the last record, there is no change and false is returned.&lt;/li&gt;
&lt;li&gt;If the result is located somewhere in the middle, an attempt is made to retrieve the next record.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If the record could not be retrieved, the result is positioned after the last record and false is returned. If the record is successfully retrieved, true is returned.&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#previous()&quot;&gt;&lt;tt&gt;previous&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#first()&quot;&gt;&lt;tt&gt;first&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#last()&quot;&gt;&lt;tt&gt;last&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#seek(int, boolean)&quot;&gt;&lt;tt&gt;seek&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#at()&quot;&gt;&lt;tt&gt;at&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#isActive()&quot;&gt;&lt;tt&gt;isActive&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#isValid()&quot;&gt;&lt;tt&gt;isValid&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final int numRowsAffected()" doc="/**
&lt;p&gt;Returns the number of rows affected by the result's SQL statement, or -1 if it cannot be determined. Note that for &lt;tt&gt;SELECT&lt;/tt&gt; statements, the value is undefined; use &lt;a href=&quot;QSqlQuery.html#size()&quot;&gt;&lt;tt&gt;size&lt;/tt&gt;&lt;/a&gt; instead. If the query is not active (&lt;a href=&quot;QSqlQuery.html#isActive()&quot;&gt;&lt;tt&gt;isActive&lt;/tt&gt;&lt;/a&gt; returns false), -1 is returned.&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#size()&quot;&gt;&lt;tt&gt;size&lt;/tt&gt;&lt;/a&gt;
@see &lt;tt&gt;QSqlDriver::hasFeature&lt;/tt&gt; */"/>
    <method name="public final com.trolltech.qt.sql.QSql.NumericalPrecisionPolicy numericalPrecisionPolicy()" doc="/**
&lt;p&gt;Returns the current precision policy.&lt;/p&gt;

@see &lt;tt&gt;QSql::NumericalPrecisionPolicy&lt;/tt&gt;
@see &lt;a href=&quot;QSqlQuery.html#setNumericalPrecisionPolicy(com.trolltech.qt.sql.QSql.NumericalPrecisionPolicy)&quot;&gt;&lt;tt&gt;setNumericalPrecisionPolicy&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean prepare(java.lang.String query)" doc="/**
&lt;p&gt;Prepares the SQL query &lt;tt&gt;query&lt;/tt&gt; for execution. Returns true if the query is prepared successfully; otherwise returns false.&lt;/p&gt;
&lt;p&gt;The query may contain placeholders for binding values. Both Oracle style colon-name (e.g&amp;#x2e;, &lt;tt&gt;:surname&lt;/tt&gt;), and ODBC style (&lt;tt&gt;?&lt;/tt&gt;) placeholders are supported; but they cannot be mixed in the same query. See the &lt;a href=&quot;QSqlQuery.html#qsqlquery-examples&quot;&gt;Detailed Description&lt;/tt&gt;&lt;/a&gt; for examples.&lt;/p&gt;
&lt;p&gt;Portability note: Some databases choose to delay preparing a query until it is executed the first time. In this case, preparing a syntactically wrong query succeeds, but every consecutive &lt;a href=&quot;QSqlQuery.html#exec()&quot;&gt;&lt;tt&gt;exec&lt;/tt&gt;&lt;/a&gt; will fail.&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#exec()&quot;&gt;&lt;tt&gt;exec&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#bindValue(java.lang.String, java.lang.Object, com.trolltech.qt.sql.QSql.ParamType)&quot;&gt;&lt;tt&gt;bindValue&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#addBindValue(java.lang.Object, com.trolltech.qt.sql.QSql.ParamType)&quot;&gt;&lt;tt&gt;addBindValue&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean previous()" doc="/**
&lt;p&gt;Retrieves the previous record in the result, if available, and positions the query on the retrieved record. Note that the result must be in an active state and &lt;a href=&quot;QSqlQuery.html#isSelect()&quot;&gt;&lt;tt&gt;isSelect&lt;/tt&gt;&lt;/a&gt; must return true before calling this function or it will do nothing and return false.&lt;/p&gt;
&lt;p&gt;The following rules apply:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If the result is currently located before the first record, there is no change and false is returned.&lt;/li&gt;
&lt;li&gt;If the result is currently located after the last record, an attempt is made to retrieve the last record.&lt;/li&gt;
&lt;li&gt;If the result is somewhere in the middle, an attempt is made to retrieve the previous record.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If the record could not be retrieved, the result is positioned before the first record and false is returned. If the record is successfully retrieved, true is returned.&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#next()&quot;&gt;&lt;tt&gt;next&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#first()&quot;&gt;&lt;tt&gt;first&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#last()&quot;&gt;&lt;tt&gt;last&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#seek(int, boolean)&quot;&gt;&lt;tt&gt;seek&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#at()&quot;&gt;&lt;tt&gt;at&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#isActive()&quot;&gt;&lt;tt&gt;isActive&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#isValid()&quot;&gt;&lt;tt&gt;isValid&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final com.trolltech.qt.sql.QSqlRecord record()" doc="/**
&lt;p&gt;Returns a &lt;a href=&quot;QSqlRecord.html&quot;&gt;&lt;tt&gt;QSqlRecord&lt;/tt&gt;&lt;/a&gt; containing the field information for the current query. If the query points to a valid row (&lt;a href=&quot;QSqlQuery.html#isValid()&quot;&gt;&lt;tt&gt;isValid&lt;/tt&gt;&lt;/a&gt; returns true), the record is populated with the row's values. An empty record is returned when there is no active query (&lt;a href=&quot;QSqlQuery.html#isActive()&quot;&gt;&lt;tt&gt;isActive&lt;/tt&gt;&lt;/a&gt; returns false).&lt;/p&gt;
&lt;p&gt;To retrieve values from a query, &lt;a href=&quot;QSqlQuery.html#value(int)&quot;&gt;&lt;tt&gt;value&lt;/tt&gt;&lt;/a&gt; should be used since its index-based lookup is faster.&lt;/p&gt;
&lt;p&gt;In the following example, a &lt;tt&gt;SELECT * FROM&lt;/tt&gt; query is executed. Since the order of the columns is not defined, QSqlRecord::indexOf() is used to obtain the index of a column.&lt;/p&gt;
&lt;pre&gt;    QSqlQuery q(&amp;quot;select * from employees&amp;quot;);
    QSqlRecord rec = q.record();

    qDebug() &amp;lt;&amp;lt; &amp;quot;Number of columns: &amp;quot; &amp;lt;&amp;lt; rec.count();

    int nameCol = rec.indexOf(&amp;quot;name&amp;quot;); &lt;span class=&quot;comment&quot;&gt;// index of the field &amp;quot;name&amp;quot;&lt;/span&gt;
    while (q.next())
        qDebug() &amp;lt;&amp;lt; q.value(nameCol).toString(); &lt;span class=&quot;comment&quot;&gt;// output all names&lt;/span&gt;&lt;/pre&gt;

@see &lt;a href=&quot;QSqlQuery.html#value(int)&quot;&gt;&lt;tt&gt;value&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final com.trolltech.qt.sql.QSqlResult result()" doc="/**
&lt;p&gt;Returns the result associated with the query.&lt;/p&gt;
 */"/>
    <method name="public final boolean seek(int i, boolean relative)" doc="/**
&lt;p&gt;Retrieves the record at position &lt;tt&gt;i&lt;/tt&gt;, if available, and positions the query on the retrieved record. The first record is at position 0. Note that the query must be in an active state and &lt;a href=&quot;QSqlQuery.html#isSelect()&quot;&gt;&lt;tt&gt;isSelect&lt;/tt&gt;&lt;/a&gt; must return true before calling this function.&lt;/p&gt;
&lt;p&gt;If &lt;tt&gt;relative&lt;/tt&gt; is false (the default), the following rules apply:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;tt&gt;i&lt;/tt&gt; is negative, the result is positioned before the first record and false is returned.&lt;/li&gt;
&lt;li&gt;Otherwise, an attempt is made to move to the record at position &lt;tt&gt;i&lt;/tt&gt;. If the record at position &lt;tt&gt;i&lt;/tt&gt; could not be retrieved, the result is positioned after the last record and false is returned. If the record is successfully retrieved, true is returned.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If &lt;tt&gt;relative&lt;/tt&gt; is true, the following rules apply:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If the result is currently positioned before the first record or on the first record, and &lt;tt&gt;i&lt;/tt&gt; is negative, there is no change, and false is returned.&lt;/li&gt;
&lt;li&gt;If the result is currently located after the last record, and &lt;tt&gt;i&lt;/tt&gt; is positive, there is no change, and false is returned.&lt;/li&gt;
&lt;li&gt;If the result is currently located somewhere in the middle, and the relative offset &lt;tt&gt;i&lt;/tt&gt; moves the result below zero, the result is positioned before the first record and false is returned.&lt;/li&gt;
&lt;li&gt;Otherwise, an attempt is made to move to the record &lt;tt&gt;i&lt;/tt&gt; records ahead of the current record (or &lt;tt&gt;i&lt;/tt&gt; records behind the current record if &lt;tt&gt;i&lt;/tt&gt; is negative). If the record at offset &lt;tt&gt;i&lt;/tt&gt; could not be retrieved, the result is positioned after the last record if &lt;tt&gt;i&lt;/tt&gt; &amp;gt;= 0, (or before the first record if &lt;tt&gt;i&lt;/tt&gt; is negative), and false is returned. If the record is successfully retrieved, true is returned.&lt;/li&gt;
&lt;/ul&gt;

@see &lt;a href=&quot;QSqlQuery.html#next()&quot;&gt;&lt;tt&gt;next&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#previous()&quot;&gt;&lt;tt&gt;previous&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#first()&quot;&gt;&lt;tt&gt;first&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#last()&quot;&gt;&lt;tt&gt;last&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#at()&quot;&gt;&lt;tt&gt;at&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#isActive()&quot;&gt;&lt;tt&gt;isActive&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#isValid()&quot;&gt;&lt;tt&gt;isValid&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final boolean seek(int i)" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QSqlQuery.html#seek(int, boolean)&quot;&gt;seek&lt;/tt&gt;&lt;/a&gt;(&lt;tt&gt;i&lt;/tt&gt;, false). */"/>
    <method name="public final void setForwardOnly(boolean forward)" doc="/**
&lt;p&gt;Sets forward only mode to &lt;tt&gt;forward&lt;/tt&gt;. If &lt;tt&gt;forward&lt;/tt&gt; is true, only &lt;a href=&quot;QSqlQuery.html#next()&quot;&gt;&lt;tt&gt;next&lt;/tt&gt;&lt;/a&gt; and &lt;a href=&quot;QSqlQuery.html#seek(int, boolean)&quot;&gt;&lt;tt&gt;seek&lt;/tt&gt;&lt;/a&gt; with positive values, are allowed for navigating the results.&lt;/p&gt;
&lt;p&gt;Forward only mode can be (depending on the driver) more memory efficient since results do not need to be cached. It will also improve performance on some databases. For this to be true, you must call &lt;tt&gt;setForwardMode()&lt;/tt&gt; before the query is prepared or executed. Note that the constructor that takes a query and a database may execute the query.&lt;/p&gt;
&lt;p&gt;Forward only mode is off by default.&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#isForwardOnly()&quot;&gt;&lt;tt&gt;isForwardOnly&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#next()&quot;&gt;&lt;tt&gt;next&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#seek(int, boolean)&quot;&gt;&lt;tt&gt;seek&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void setNumericalPrecisionPolicy(com.trolltech.qt.sql.QSql.NumericalPrecisionPolicy precisionPolicy)" doc="/**
&lt;p&gt;Instruct the database driver to return numerical values with a precision specified by &lt;tt&gt;precisionPolicy&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;The Oracle driver, for example, retrieves numerical values as strings by default to prevent the loss of precision. If the high precision doesn't matter, use this method to increase execution speed by bypassing string conversions.&lt;/p&gt;
&lt;p&gt;Note: Drivers that don't support fetching numerical values with low precision will ignore the precision policy. You can use QSqlDriver::hasFeature() to find out whether a driver supports this feature.&lt;/p&gt;
&lt;p&gt;Note: Setting the precision policy doesn't affect the currently active query. Call &lt;a href=&quot;QSqlQuery.html#exec()&quot;&gt;exec(&lt;/tt&gt;QString)&lt;/tt&gt;&lt;/a&gt; or &lt;a href=&quot;QSqlQuery.html#prepare(java.lang.String)&quot;&gt;&lt;tt&gt;prepare&lt;/tt&gt;&lt;/a&gt; in order to activate the policy.&lt;/p&gt;

@see &lt;tt&gt;QSql::NumericalPrecisionPolicy&lt;/tt&gt;
@see &lt;a href=&quot;QSqlQuery.html#numericalPrecisionPolicy()&quot;&gt;&lt;tt&gt;numericalPrecisionPolicy&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final int size()" doc="/**
&lt;p&gt;Returns the size of the result (number of rows returned), or -1 if the size cannot be determined or if the database does not support reporting information about query sizes. Note that for non-&lt;tt&gt;SELECT&lt;/tt&gt; statements (&lt;a href=&quot;QSqlQuery.html#isSelect()&quot;&gt;&lt;tt&gt;isSelect&lt;/tt&gt;&lt;/a&gt; returns false), &lt;a href=&quot;QSqlQuery.html#size()&quot;&gt;&lt;tt&gt;size&lt;/tt&gt;&lt;/a&gt; will return -1. If the query is not active (&lt;a href=&quot;QSqlQuery.html#isActive()&quot;&gt;&lt;tt&gt;isActive&lt;/tt&gt;&lt;/a&gt; returns false), -1 is returned.&lt;/p&gt;
&lt;p&gt;To determine the number of rows affected by a non-&lt;tt&gt;SELECT&lt;/tt&gt; statement, use &lt;a href=&quot;QSqlQuery.html#numRowsAffected()&quot;&gt;&lt;tt&gt;numRowsAffected&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#isActive()&quot;&gt;&lt;tt&gt;isActive&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#numRowsAffected()&quot;&gt;&lt;tt&gt;numRowsAffected&lt;/tt&gt;&lt;/a&gt;
@see &lt;tt&gt;QSqlDriver::hasFeature&lt;/tt&gt; */"/>
    <method name="public final java.lang.Object value(int i)" doc="/**
&lt;p&gt;Returns the value of field &lt;tt&gt;i&lt;/tt&gt; in the current record.&lt;/p&gt;
&lt;p&gt;The fields are numbered from left to right using the text of the &lt;tt&gt;SELECT&lt;/tt&gt; statement, e.g&amp;#x2e; in&lt;/p&gt;
&lt;pre&gt;    SELECT forename, surname FROM people;&lt;/pre&gt;
&lt;p&gt;field 0 is &lt;tt&gt;forename&lt;/tt&gt; and field 1 is &lt;tt&gt;surname&lt;/tt&gt;. Using &lt;tt&gt;SELECT *&lt;/tt&gt; is not recommended because the order of the fields in the query is undefined.&lt;/p&gt;
&lt;p&gt;An invalid &lt;a href=&quot;%2E%2E/porting4.html#qvariant&quot;&gt;&lt;tt&gt;QVariant&lt;/tt&gt;&lt;/a&gt; is returned if field &lt;tt&gt;i&lt;/tt&gt; does not exist, if the query is inactive, or if the query is positioned on an invalid record.&lt;/p&gt;

@see &lt;a href=&quot;QSqlQuery.html#previous()&quot;&gt;&lt;tt&gt;previous&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#next()&quot;&gt;&lt;tt&gt;next&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#first()&quot;&gt;&lt;tt&gt;first&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#last()&quot;&gt;&lt;tt&gt;last&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#seek(int, boolean)&quot;&gt;&lt;tt&gt;seek&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#isActive()&quot;&gt;&lt;tt&gt;isActive&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;QSqlQuery.html#isValid()&quot;&gt;&lt;tt&gt;isValid&lt;/tt&gt;&lt;/a&gt; */"/>
    <enum name="BatchExecutionMode">
        <enum-value name="ValuesAsRows" doc="/**
&lt;p&gt;- Updates multiple rows. Treats every entry in a QVariantList as a value for updating the next row.&lt;/p&gt;
 */"/>
        <enum-value name="ValuesAsColumns" doc="/**
&lt;p&gt;- Updates a single row. Treats every entry in a QVariantList as a single value of an array type.&lt;/p&gt;
 */"/>
</enum>
</class>