Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 1029

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QSqlResult Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QSqlResult Class Reference<br /><sup><sup>[<a href="qtsql.html">QtSql</a> module]</sup></sup></h1><p>The QSqlResult class provides an abstract interface for
accessing data from specific SQL databases. <a href="#details">More...</a></p>

<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qsqlresult.html#BindingSyntax-enum">BindingSyntax</a></b> { PositionalBinding, NamedBinding }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qsqlresult.html#QSqlResult">__init__</a></b> (<i>self</i>, QSqlDriver&#160;<i>db</i>)</li><li><div class="fn" /><b><a href="qsqlresult.html#addBindValue">addBindValue</a></b> (<i>self</i>, QVariant&#160;<i>val</i>, QSql.ParamType&#160;<i>type</i>)</li><li><div class="fn" />int <b><a href="qsqlresult.html#at">at</a></b> (<i>self</i>)</li><li><div class="fn" />BindingSyntax <b><a href="qsqlresult.html#bindingSyntax">bindingSyntax</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsqlresult.html#bindValue">bindValue</a></b> (<i>self</i>, int&#160;<i>pos</i>, QVariant&#160;<i>val</i>, QSql.ParamType&#160;<i>type</i>)</li><li><div class="fn" /><b><a href="qsqlresult.html#bindValue-2">bindValue</a></b> (<i>self</i>, QString&#160;<i>placeholder</i>, QVariant&#160;<i>val</i>, QSql.ParamType&#160;<i>type</i>)</li><li><div class="fn" />QSql.ParamType <b><a href="qsqlresult.html#bindValueType">bindValueType</a></b> (<i>self</i>, QString&#160;<i>placeholder</i>)</li><li><div class="fn" />QSql.ParamType <b><a href="qsqlresult.html#bindValueType-2">bindValueType</a></b> (<i>self</i>, int&#160;<i>pos</i>)</li><li><div class="fn" />QVariant <b><a href="qsqlresult.html#boundValue">boundValue</a></b> (<i>self</i>, QString&#160;<i>placeholder</i>)</li><li><div class="fn" />QVariant <b><a href="qsqlresult.html#boundValue-2">boundValue</a></b> (<i>self</i>, int&#160;<i>pos</i>)</li><li><div class="fn" />int <b><a href="qsqlresult.html#boundValueCount">boundValueCount</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qsqlresult.html#boundValueName">boundValueName</a></b> (<i>self</i>, int&#160;<i>pos</i>)</li><li><div class="fn" />list-of-QVariant <b><a href="qsqlresult.html#boundValues">boundValues</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qsqlresult.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" />QVariant <b><a href="qsqlresult.html#data">data</a></b> (<i>self</i>, int&#160;<i>i</i>)</li><li><div class="fn" />QSqlDriver <b><a href="qsqlresult.html#driver">driver</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsqlresult.html#exec">exec_</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qsqlresult.html#executedQuery">executedQuery</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsqlresult.html#fetch">fetch</a></b> (<i>self</i>, int&#160;<i>i</i>)</li><li><div class="fn" />bool <b><a href="qsqlresult.html#fetchFirst">fetchFirst</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsqlresult.html#fetchLast">fetchLast</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsqlresult.html#fetchNext">fetchNext</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsqlresult.html#fetchPrevious">fetchPrevious</a></b> (<i>self</i>)</li><li><div class="fn" />QVariant <b><a href="qsqlresult.html#handle">handle</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsqlresult.html#hasOutValues">hasOutValues</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsqlresult.html#isActive">isActive</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsqlresult.html#isForwardOnly">isForwardOnly</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsqlresult.html#isNull">isNull</a></b> (<i>self</i>, int&#160;<i>i</i>)</li><li><div class="fn" />bool <b><a href="qsqlresult.html#isSelect">isSelect</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsqlresult.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />QSqlError <b><a href="qsqlresult.html#lastError">lastError</a></b> (<i>self</i>)</li><li><div class="fn" />QVariant <b><a href="qsqlresult.html#lastInsertId">lastInsertId</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qsqlresult.html#lastQuery">lastQuery</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qsqlresult.html#numRowsAffected">numRowsAffected</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsqlresult.html#prepare">prepare</a></b> (<i>self</i>, QString&#160;<i>query</i>)</li><li><div class="fn" />QSqlRecord <b><a href="qsqlresult.html#record">record</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qsqlresult.html#reset">reset</a></b> (<i>self</i>, QString&#160;<i>sqlquery</i>)</li><li><div class="fn" />bool <b><a href="qsqlresult.html#savePrepare">savePrepare</a></b> (<i>self</i>, QString&#160;<i>sqlquery</i>)</li><li><div class="fn" /><b><a href="qsqlresult.html#setActive">setActive</a></b> (<i>self</i>, bool&#160;<i>a</i>)</li><li><div class="fn" /><b><a href="qsqlresult.html#setAt">setAt</a></b> (<i>self</i>, int&#160;<i>at</i>)</li><li><div class="fn" /><b><a href="qsqlresult.html#setForwardOnly">setForwardOnly</a></b> (<i>self</i>, bool&#160;<i>forward</i>)</li><li><div class="fn" /><b><a href="qsqlresult.html#setLastError">setLastError</a></b> (<i>self</i>, QSqlError&#160;<i>e</i>)</li><li><div class="fn" /><b><a href="qsqlresult.html#setQuery">setQuery</a></b> (<i>self</i>, QString&#160;<i>query</i>)</li><li><div class="fn" /><b><a href="qsqlresult.html#setSelect">setSelect</a></b> (<i>self</i>, bool&#160;<i>s</i>)</li><li><div class="fn" />int <b><a href="qsqlresult.html#size">size</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QSqlResult class provides an abstract interface for
accessing data from specific SQL databases.</p>
<p>Normally, you would use <a href="qsqlquery.html">QSqlQuery</a>
instead of QSqlResult, since <a href="qsqlquery.html">QSqlQuery</a>
provides a generic wrapper for database-specific implementations of
QSqlResult.</p>
<p>If you are implementing your own SQL driver (by subclassing
<a href="qsqldriver.html">QSqlDriver</a>), you will need to provide
your own QSqlResult subclass that implements all the pure virtual
functions and other virtual functions that you need.</p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="BindingSyntax-enum" />QSqlResult.BindingSyntax</h3><p>This enum type specifies the different syntaxes for specifying
placeholders in prepared queries.</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QSqlResult.PositionalBinding</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">Use the ODBC-style positional syntax, with "?"
as placeholders.</td>
</tr>
<tr>
<td class="topAlign"><tt>QSqlResult.NamedBinding</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">Use the Oracle-style syntax with named
placeholders (e.g., ":id")</td>
</tr>
</table>
<p><b>See also</b> <a href="qsqlresult.html#bindingSyntax">bindingSyntax</a>().</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QSqlResult" />QSqlResult.__init__ (<i>self</i>, <a href="qsqldriver.html">QSqlDriver</a>&#160;<i>db</i>)</h3><p>Creates a <a href="qsqlresult.html">QSqlResult</a> using
database driver <i>db</i>. The object is initialized to an inactive
state.</p>
<p><b>See also</b> <a href="qsqlresult.html#isActive">isActive</a>() and <a href="qsqlresult.html#driver">driver</a>().</p>


<h3 class="fn"><a name="addBindValue" />QSqlResult.addBindValue (<i>self</i>, QVariant&#160;<i>val</i>, <a href="qsql-paramtype.html">QSql.ParamType</a>&#160;<i>type</i>)</h3><p>Binds the value <i>val</i> of parameter type <i>paramType</i> to
the next available position in the current record (row).</p>
<p><b>See also</b> <a href="qsqlresult.html#bindValue">bindValue</a>().</p>


<h3 class="fn"><a name="at" />int QSqlResult.at (<i>self</i>)</h3><p>Returns the current (zero-based) row position of the result. May
return the special values <a href="qsql.html#Location-enum">QSql.BeforeFirstRow</a> or <a href="qsql.html#Location-enum">QSql.AfterLastRow</a>.</p>
<p><b>See also</b> <a href="qsqlresult.html#setAt">setAt</a>() and
<a href="qsqlresult.html#isValid">isValid</a>().</p>


<h3 class="fn"><a name="bindingSyntax" /><a href="qsqlresult.html#BindingSyntax-enum">BindingSyntax</a> QSqlResult.bindingSyntax (<i>self</i>)</h3><p>Returns the binding syntax used by prepared queries.</p>


<h3 class="fn"><a name="bindValue" />QSqlResult.bindValue (<i>self</i>, int&#160;<i>pos</i>, QVariant&#160;<i>val</i>, <a href="qsql-paramtype.html">QSql.ParamType</a>&#160;<i>type</i>)</h3><p>Binds the value <i>val</i> of parameter type <i>paramType</i> to
position <i>index</i> in the current record (row).</p>
<p><b>See also</b> <a href="qsqlresult.html#addBindValue">addBindValue</a>().</p>


<h3 class="fn"><a name="bindValue-2" />QSqlResult.bindValue (<i>self</i>, QString&#160;<i>placeholder</i>, QVariant&#160;<i>val</i>, <a href="qsql-paramtype.html">QSql.ParamType</a>&#160;<i>type</i>)</h3><p>This is an overloaded function.</p>
<p>Binds the value <i>val</i> of parameter type <i>paramType</i> to
the <i>placeholder</i> name in the current record (row).</p>
<p>Values cannot be bound to multiple locations in the query,
eg:</p>
<pre class="cpp">
 INSERT INTO testtable (id<span class="operator">,</span> name<span class="operator">,</span> samename) VALUES (:id<span class="operator">,</span> :name<span class="operator">,</span> :name)
</pre>
<p>Binding to name will bind to the first :name, but not the
second.</p>
<p><b>Note:</b> Binding an undefined placeholder will result in
undefined behavior.</p>
<p><b>See also</b> <a href="qsqlquery.html#bindValue">QSqlQuery.bindValue</a>().</p>


<h3 class="fn"><a name="bindValueType" /><a href="qsql-paramtype.html">QSql.ParamType</a> QSqlResult.bindValueType (<i>self</i>, QString&#160;<i>placeholder</i>)</h3><p>Returns the parameter type for the value bound at position
<i>index</i>.</p>
<p><b>See also</b> <a href="qsqlresult.html#boundValue">boundValue</a>().</p>


<h3 class="fn"><a name="bindValueType-2" /><a href="qsql-paramtype.html">QSql.ParamType</a> QSqlResult.bindValueType (<i>self</i>, int&#160;<i>pos</i>)</h3><p>This is an overloaded function.</p>
<p>Returns the parameter type for the value bound with the given
<i>placeholder</i> name.</p>


<h3 class="fn"><a name="boundValue" />QVariant QSqlResult.boundValue (<i>self</i>, QString&#160;<i>placeholder</i>)</h3><p>Returns the value bound at position <i>index</i> in the current
record (row).</p>
<p><b>See also</b> <a href="qsqlresult.html#bindValue">bindValue</a>() and <a href="qsqlresult.html#boundValues">boundValues</a>().</p>


<h3 class="fn"><a name="boundValue-2" />QVariant QSqlResult.boundValue (<i>self</i>, int&#160;<i>pos</i>)</h3><p>This is an overloaded function.</p>
<p>Returns the value bound by the given <i>placeholder</i> name in
the current record (row).</p>
<p><b>See also</b> <a href="qsqlresult.html#bindValueType">bindValueType</a>().</p>


<h3 class="fn"><a name="boundValueCount" />int QSqlResult.boundValueCount (<i>self</i>)</h3><p>Returns the number of bound values in the result.</p>
<p><b>See also</b> <a href="qsqlresult.html#boundValues">boundValues</a>().</p>


<h3 class="fn"><a name="boundValueName" />QString QSqlResult.boundValueName (<i>self</i>, int&#160;<i>pos</i>)</h3><p>Returns the name of the bound value at position <i>index</i> in
the current record (row).</p>
<p><b>See also</b> <a href="qsqlresult.html#boundValue">boundValue</a>().</p>


<h3 class="fn"><a name="boundValues" />list-of-QVariant QSqlResult.boundValues (<i>self</i>)</h3><p>Returns a vector of the result's bound values for the current
record (row).</p>
<p><b>See also</b> <a href="qsqlresult.html#boundValueCount">boundValueCount</a>().</p>


<h3 class="fn"><a name="clear" />QSqlResult.clear (<i>self</i>)</h3><p>Clears the entire result set and releases any associated
resources.</p>


<h3 class="fn"><a name="data" />QVariant QSqlResult.data (<i>self</i>, int&#160;<i>i</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the data for field <i>index</i> in the current row as a
<a href="qvariant.html">QVariant</a>. This function is only called
if the result is in an active state and is positioned on a valid
record and <i>index</i> is non-negative. Derived classes must
reimplement this function and return the value of field
<i>index</i>, or QVariant() if it cannot be determined.</p>


<h3 class="fn"><a name="driver" /><a href="qsqldriver.html">QSqlDriver</a> QSqlResult.driver (<i>self</i>)</h3><p>Returns the driver associated with the result. This is the
object that was passed to the constructor.</p>


<h3 class="fn"><a name="exec" />bool QSqlResult.exec_ (<i>self</i>)</h3><p>Executes the query, returning true if successful; otherwise
returns false.</p>
<p><b>See also</b> <a href="qsqlresult.html#prepare">prepare</a>().</p>


<h3 class="fn"><a name="executedQuery" />QString QSqlResult.executedQuery (<i>self</i>)</h3><p>Returns the query that was actually executed. This may differ
from the query that was passed, for example if bound values were
used with a prepared query and the underlying database doesn't
support prepared queries.</p>
<p><b>See also</b> <a href="qsqlresult.html#exec">exec_</a>() and
<a href="qsqlresult.html#setQuery">setQuery</a>().</p>


<h3 class="fn"><a name="fetch" />bool QSqlResult.fetch (<i>self</i>, int&#160;<i>i</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Positions the result to an arbitrary (zero-based) row
<i>index</i>.</p>
<p>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 row <i>index</i>, and call <a href="qsqlresult.html#setAt">setAt</a>() with an appropriate value.
Return true to indicate success, or false to signify failure.</p>
<p><b>See also</b> <a href="qsqlresult.html#isActive">isActive</a>(), <a href="qsqlresult.html#fetchFirst">fetchFirst</a>(), <a href="qsqlresult.html#fetchLast">fetchLast</a>(), <a href="qsqlresult.html#fetchNext">fetchNext</a>(), and <a href="qsqlresult.html#fetchPrevious">fetchPrevious</a>().</p>


<h3 class="fn"><a name="fetchFirst" />bool QSqlResult.fetchFirst (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Positions the result to the first record (row 0) in the
result.</p>
<p>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 <a href="qsqlresult.html#setAt">setAt</a>() with an appropriate value.
Return true to indicate success, or false to signify failure.</p>
<p><b>See also</b> <a href="qsqlresult.html#fetch">fetch</a>() and
<a href="qsqlresult.html#fetchLast">fetchLast</a>().</p>


<h3 class="fn"><a name="fetchLast" />bool QSqlResult.fetchLast (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Positions the result to the last record (last row) in the
result.</p>
<p>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 <a href="qsqlresult.html#setAt">setAt</a>() with an appropriate value.
Return true to indicate success, or false to signify failure.</p>
<p><b>See also</b> <a href="qsqlresult.html#fetch">fetch</a>() and
<a href="qsqlresult.html#fetchFirst">fetchFirst</a>().</p>


<h3 class="fn"><a name="fetchNext" />bool QSqlResult.fetchNext (<i>self</i>)</h3><p>Positions the result to the next available record (row) in the
result.</p>
<p>This function is only called if the result is in an active
state. The default implementation calls <a href="qsqlresult.html#fetch">fetch</a>() with the next index. Derived
classes can reimplement this function and position the result to
the next record in some other way, and call <a href="qsqlresult.html#setAt">setAt</a>() with an appropriate value.
Return true to indicate success, or false to signify failure.</p>
<p><b>See also</b> <a href="qsqlresult.html#fetch">fetch</a>() and
<a href="qsqlresult.html#fetchPrevious">fetchPrevious</a>().</p>


<h3 class="fn"><a name="fetchPrevious" />bool QSqlResult.fetchPrevious (<i>self</i>)</h3><p>Positions the result to the previous record (row) in the
result.</p>
<p>This function is only called if the result is in an active
state. The default implementation calls <a href="qsqlresult.html#fetch">fetch</a>() with the previous index.
Derived classes can reimplement this function and position the
result to the next record in some other way, and call <a href="qsqlresult.html#setAt">setAt</a>() with an appropriate value.
Return true to indicate success, or false to signify failure.</p>


<h3 class="fn"><a name="handle" />QVariant QSqlResult.handle (<i>self</i>)</h3><p>Returns the low-level database handle for this result set
wrapped in a <a href="qvariant.html">QVariant</a> or an invalid
<a href="qvariant.html">QVariant</a> 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 result is modified (for example, if you clear
it).</p>
<p><b>Warning:</b> The handle can be NULL if the result was not
executed 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 sqlite result:</p>
<pre class="cpp">
 <span class="type"><a href="qsqlquery.html">QSqlQuery</a></span> query <span class="operator">=</span> <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 <span class="type"><a href="qvariant.html">QVariant</a></span> v <span class="operator">=</span> query<span class="operator">.</span>result()<span class="operator">-</span><span class="operator">&gt;</span>handle();
 <span class="keyword">if</span> (v<span class="operator">.</span>isValid() <span class="operator">&amp;</span><span class="operator">&amp;</span> qstrcmp(v<span class="operator">.</span>typeName()<span class="operator">,</span> <span class="string">"sqlite3_stmt*"</span>)) {
     <span class="comment">// v.data() returns a pointer to the handle</span>
     sqlite3_stmt <span class="operator">*</span>handle <span class="operator">=</span> <span class="operator">*</span><span class="keyword">static_cast</span><span class="operator">&lt;</span>sqlite3_stmt <span class="operator">*</span><span class="operator">*</span><span class="operator">&gt;</span>(v<span class="operator">.</span>data());
     <span class="keyword">if</span> (handle <span class="operator">!</span><span class="operator">=</span> <span class="number">0</span>) { <span class="comment">// check that it is not NULL</span>
         <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
     }
 }
</pre>
<p>This snippet returns the handle for PostgreSQL or MySQL:</p>
<pre class="cpp">
 <span class="keyword">if</span> (v<span class="operator">.</span>typeName() <span class="operator">=</span><span class="operator">=</span> <span class="string">"PGresult*"</span>) {
     PGresult <span class="operator">*</span>handle <span class="operator">=</span> <span class="operator">*</span><span class="keyword">static_cast</span><span class="operator">&lt;</span>PGresult <span class="operator">*</span><span class="operator">*</span><span class="operator">&gt;</span>(v<span class="operator">.</span>data());
     <span class="keyword">if</span> (handle <span class="operator">!</span><span class="operator">=</span> <span class="number">0</span>) <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 }

 <span class="keyword">if</span> (v<span class="operator">.</span>typeName() <span class="operator">=</span><span class="operator">=</span> <span class="string">"MYSQL_STMT*"</span>) {
     MYSQL_STMT <span class="operator">*</span>handle <span class="operator">=</span> <span class="operator">*</span><span class="keyword">static_cast</span><span class="operator">&lt;</span>MYSQL_STMT <span class="operator">*</span><span class="operator">*</span><span class="operator">&gt;</span>(v<span class="operator">.</span>data());
     <span class="keyword">if</span> (handle <span class="operator">!</span><span class="operator">=</span> <span class="number">0</span>) <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 }
</pre>
<p><b>See also</b> <a href="qsqldriver.html#handle">QSqlDriver.handle</a>().</p>


<h3 class="fn"><a name="hasOutValues" />bool QSqlResult.hasOutValues (<i>self</i>)</h3><p>Returns true if at least one of the query's bound values is a
<tt>QSql.Out</tt> or a <a href="qsql.html#ParamTypeFlag-enum">QSql.InOut</a>; otherwise returns
false.</p>
<p><b>See also</b> <a href="qsqlresult.html#bindValueType">bindValueType</a>().</p>


<h3 class="fn"><a name="isActive" />bool QSqlResult.isActive (<i>self</i>)</h3><p>Returns true if the result has records to be retrieved;
otherwise returns false.</p>


<h3 class="fn"><a name="isForwardOnly" />bool QSqlResult.isForwardOnly (<i>self</i>)</h3><p>Returns true if you can only scroll forward through the result
set; otherwise returns false.</p>
<p><b>See also</b> <a href="qsqlresult.html#setForwardOnly">setForwardOnly</a>().</p>


<h3 class="fn"><a name="isNull" />bool QSqlResult.isNull (<i>self</i>, int&#160;<i>i</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns true if the field at position <i>index</i> in the
current row is null; otherwise returns false.</p>


<h3 class="fn"><a name="isSelect" />bool QSqlResult.isSelect (<i>self</i>)</h3><p>Returns true if the current result is from a <tt>SELECT</tt>
statement; otherwise returns false.</p>
<p><b>See also</b> <a href="qsqlresult.html#setSelect">setSelect</a>().</p>


<h3 class="fn"><a name="isValid" />bool QSqlResult.isValid (<i>self</i>)</h3><p>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.</p>
<p><b>See also</b> <a href="qsqlresult.html#at">at</a>().</p>


<h3 class="fn"><a name="lastError" /><a href="qsqlerror.html">QSqlError</a> QSqlResult.lastError (<i>self</i>)</h3><p>Returns the last error associated with the result.</p>
<p><b>See also</b> <a href="qsqlresult.html#setLastError">setLastError</a>().</p>


<h3 class="fn"><a name="lastInsertId" />QVariant QSqlResult.lastInsertId (<i>self</i>)</h3><p>Returns the object ID of the most recent inserted row if the
database supports it. An invalid <a href="qvariant.html">QVariant</a> 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.</p>
<p>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.</p>
<p><b>See also</b> <a href="qsqldriver.html#hasFeature">QSqlDriver.hasFeature</a>().</p>


<h3 class="fn"><a name="lastQuery" />QString QSqlResult.lastQuery (<i>self</i>)</h3><p>Returns the current SQL query text, or an empty string if there
isn't one.</p>
<p><b>See also</b> <a href="qsqlresult.html#setQuery">setQuery</a>().</p>


<h3 class="fn"><a name="numRowsAffected" />int QSqlResult.numRowsAffected (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the number of rows affected by the last query executed,
or -1 if it cannot be determined or if the query is a
<tt>SELECT</tt> statement.</p>
<p><b>See also</b> <a href="qsqlresult.html#size">size</a>().</p>


<h3 class="fn"><a name="prepare" />bool QSqlResult.prepare (<i>self</i>, QString&#160;<i>query</i>)</h3><p>Prepares the given <i>query</i> for execution; the query will
normally use placeholders so that it can be executed repeatedly.
Returns true if the query is prepared successfully; otherwise
returns false.</p>
<p><b>See also</b> <a href="qsqlresult.html#exec">exec_</a>().</p>


<h3 class="fn"><a name="record" /><a href="qsqlrecord.html">QSqlRecord</a> QSqlResult.record (<i>self</i>)</h3><p>Returns the current record if the query is active; otherwise
returns an empty <a href="qsqlrecord.html">QSqlRecord</a>.</p>
<p>The default implementation always returns an empty <a href="qsqlrecord.html">QSqlRecord</a>.</p>
<p><b>See also</b> <a href="qsqlresult.html#isActive">isActive</a>().</p>


<h3 class="fn"><a name="reset" />bool QSqlResult.reset (<i>self</i>, QString&#160;<i>sqlquery</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Sets the result to use the SQL statement <i>query</i> for
subsequent data retrieval.</p>
<p>Derived classes must reimplement this function and apply the
<i>query</i> to the database. This function is only called 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.</p>
<p><b>See also</b> <a href="qsqlresult.html#setQuery">setQuery</a>().</p>


<h3 class="fn"><a name="savePrepare" />bool QSqlResult.savePrepare (<i>self</i>, QString&#160;<i>sqlquery</i>)</h3><p>Prepares the given <i>query</i>, using the underlying database
functionality where possible. Returns true if the query is prepared
successfully; otherwise returns false.</p>
<p><b>See also</b> <a href="qsqlresult.html#prepare">prepare</a>().</p>


<h3 class="fn"><a name="setActive" />QSqlResult.setActive (<i>self</i>, bool&#160;<i>a</i>)</h3><p>This function is provided for derived classes to set the
internal active state to <i>active</i>.</p>
<p><b>See also</b> <a href="qsqlresult.html#isActive">isActive</a>().</p>


<h3 class="fn"><a name="setAt" />QSqlResult.setAt (<i>self</i>, int&#160;<i>at</i>)</h3><p>This function is provided for derived classes to set the
internal (zero-based) row position to <i>index</i>.</p>
<p><b>See also</b> <a href="qsqlresult.html#at">at</a>().</p>


<h3 class="fn"><a name="setForwardOnly" />QSqlResult.setForwardOnly (<i>self</i>, bool&#160;<i>forward</i>)</h3><p>Sets forward only mode to <i>forward</i>. If <i>forward</i> is
true, only <a href="qsqlresult.html#fetchNext">fetchNext</a>() is
allowed for navigating the results. Forward only mode needs much
less memory since results do not have to be cached. By default,
this feature is disabled.</p>
<p>Setting forward only to false is a suggestion to the database
engine, which has the final say on whether a result set is forward
only or scrollable. <a href="qsqlresult.html#isForwardOnly">isForwardOnly</a>() will always
return the correct status of the result set.</p>
<p><b>Note:</b> Calling setForwardOnly after execution of the query
will result in unexpected results at best, and crashes at
worst.</p>
<p><b>See also</b> <a href="qsqlresult.html#isForwardOnly">isForwardOnly</a>(), <a href="qsqlresult.html#fetchNext">fetchNext</a>(), and <a href="qsqlquery.html#setForwardOnly">QSqlQuery.setForwardOnly</a>().</p>


<h3 class="fn"><a name="setLastError" />QSqlResult.setLastError (<i>self</i>, <a href="qsqlerror.html">QSqlError</a>&#160;<i>e</i>)</h3><p>This function is provided for derived classes to set the last
error to <i>error</i>.</p>
<p><b>See also</b> <a href="qsqlresult.html#lastError">lastError</a>().</p>


<h3 class="fn"><a name="setQuery" />QSqlResult.setQuery (<i>self</i>, QString&#160;<i>query</i>)</h3><p>Sets the current query for the result to <i>query</i>. You must
call <a href="qsqlresult.html#reset">reset</a>() to execute the
query on the database.</p>
<p><b>See also</b> <a href="qsqlresult.html#reset">reset</a>() and
<a href="qsqlresult.html#lastQuery">lastQuery</a>().</p>


<h3 class="fn"><a name="setSelect" />QSqlResult.setSelect (<i>self</i>, bool&#160;<i>s</i>)</h3><p>This function is provided for derived classes to indicate
whether or not the current statement is a SQL <tt>SELECT</tt>
statement. The <i>select</i> parameter should be true if the
statement is a <tt>SELECT</tt> statement; otherwise it should be
false.</p>
<p><b>See also</b> <a href="qsqlresult.html#isSelect">isSelect</a>().</p>


<h3 class="fn"><a name="size" />int QSqlResult.size (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the size of the <tt>SELECT</tt> result, or -1 if it
cannot be determined or if the query is not a <tt>SELECT</tt>
statement.</p>
<p><b>See also</b> <a href="qsqlresult.html#numRowsAffected">numRowsAffected</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>