Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > ff187cb994c94c614ecc64c5a8528b1b > files > 4666

qt-doc-4.8.5-10.fc18.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- q3sqlcursor.cpp -->
  <title>Qt 4.8: Q3SqlCursor Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qt3support.html">Qt3Support</a></li>
<li>Q3SqlCursor</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">Q3SqlCursor Class Reference</h1>
<!-- $$$Q3SqlCursor-brief -->
<p>The Q3SqlCursor class provides browsing and editing of SQL tables and views. <a href="#details">More...</a></p>
<!-- @@@Q3SqlCursor -->
<pre class="cpp"> <span class="preprocessor">#include &lt;Q3SqlCursor&gt;</span></pre><p><b>This class is part of the Qt 3 support library.</b> It is provided to keep old source code working. We strongly advise against using it in new code. See <a href="porting4.html#qsqlcursor">Porting to Qt 4</a> for more information.</p>
<p><b>Inherits: </b><a href="qsqlrecord.html">QSqlRecord</a> and <a href="qsqlquery.html">QSqlQuery</a>.</p>
<p><b>Inherited by: </b><a href="q3sqlselectcursor.html">Q3SqlSelectCursor</a>.</p>
<ul>
<li><a href="q3sqlcursor-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#Mode-enum">Mode</a></b> { ReadOnly, Insert, Update, Delete, Writable }</td></tr>
</table>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#Q3SqlCursor">Q3SqlCursor</a></b> ( const QString &amp; <i>name</i> = QString(), bool <i>autopopulate</i> = true, QSqlDatabase <i>db</i> = QSqlDatabase() )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#Q3SqlCursor-2">Q3SqlCursor</a></b> ( const Q3SqlCursor &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#dtor.Q3SqlCursor">~Q3SqlCursor</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#append">append</a></b> ( const Q3SqlFieldInfo &amp; <i>fieldInfo</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#canDelete">canDelete</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#canInsert">canInsert</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#canUpdate">canUpdate</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#clear">clear</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#del">del</a></b> ( bool <i>invalidate</i> = true )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSqlRecord * </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#editBuffer">editBuffer</a></b> ( bool <i>copy</i> = false )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#filter">filter</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSqlIndex </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#index">index</a></b> ( const QStringList &amp; <i>fieldNames</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSqlIndex </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#index-2">index</a></b> ( const QString &amp; <i>fieldName</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#insert">insert</a></b> ( int <i>pos</i>, const Q3SqlFieldInfo &amp; <i>fieldInfo</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#insert-2">insert</a></b> ( bool <i>invalidate</i> = true )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#isCalculated">isCalculated</a></b> ( const QString &amp; <i>name</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#isNull">isNull</a></b> ( int <i>i</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#isNull-2">isNull</a></b> ( const QString &amp; <i>name</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#isReadOnly">isReadOnly</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#isTrimmed">isTrimmed</a></b> ( const QString &amp; <i>name</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#mode">mode</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#name">name</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSqlIndex </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#primaryIndex">primaryIndex</a></b> ( bool <i>setFromCursor</i> = true ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSqlRecord * </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#primeDelete">primeDelete</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSqlRecord * </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#primeInsert">primeInsert</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QSqlRecord * </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#primeUpdate">primeUpdate</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#remove">remove</a></b> ( int <i>pos</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#select">select</a></b> ( const QString &amp; <i>filter</i>, const QSqlIndex &amp; <i>sort</i> = QSqlIndex() )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#select-2">select</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#select-3">select</a></b> ( const QSqlIndex &amp; <i>sort</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#select-4">select</a></b> ( const QSqlIndex &amp; <i>filter</i>, const QSqlIndex &amp; <i>sort</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#setCalculated">setCalculated</a></b> ( const QString &amp; <i>name</i>, bool <i>calculated</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#setFilter">setFilter</a></b> ( const QString &amp; <i>filter</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#setGenerated">setGenerated</a></b> ( const QString &amp; <i>name</i>, bool <i>generated</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#setGenerated-2">setGenerated</a></b> ( int <i>i</i>, bool <i>generated</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#setMode">setMode</a></b> ( int <i>mode</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#setName">setName</a></b> ( const QString &amp; <i>name</i>, bool <i>autopopulate</i> = true )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#setPrimaryIndex">setPrimaryIndex</a></b> ( const QSqlIndex &amp; <i>idx</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#setSort">setSort</a></b> ( const QSqlIndex &amp; <i>sort</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#setTrimmed">setTrimmed</a></b> ( const QString &amp; <i>name</i>, bool <i>trim</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#setValue">setValue</a></b> ( const QString &amp; <i>name</i>, const QVariant &amp; <i>val</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSqlIndex </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#sort">sort</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#update">update</a></b> ( bool <i>invalidate</i> = true )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVariant </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#value">value</a></b> ( int <i>i</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVariant </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#value-2">value</a></b> ( const QString &amp; <i>name</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Q3SqlCursor &amp; </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#operator-eq">operator=</a></b> ( const Q3SqlCursor &amp; <i>other</i> )</td></tr>
</table>
<ul>
<li class="fn">28 public functions inherited from <a href="qsqlrecord.html#public-functions">QSqlRecord</a></li>
<li class="fn">38 public functions inherited from <a href="qsqlquery.html#public-functions">QSqlQuery</a></li>
</ul>
<a name="protected-functions"></a>
<h2>Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual QVariant </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#calculateField">calculateField</a></b> ( const QString &amp; <i>name</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#del-2">del</a></b> ( const QString &amp; <i>filter</i>, bool <i>invalidate</i> = true )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#exec">exec</a></b> ( const QString &amp; <i>sql</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QString </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#toString">toString</a></b> ( QSqlRecord * <i>rec</i>, const QString &amp; <i>prefix</i>, const QString &amp; <i>fieldSep</i>, const QString &amp; <i>sep</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QString </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#toString-3">toString</a></b> ( const QString &amp; <i>prefix</i>, QSqlField * <i>field</i>, const QString &amp; <i>fieldSep</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QString </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#toString-4">toString</a></b> ( const QSqlIndex &amp; <i>i</i>, QSqlRecord * <i>rec</i>, const QString &amp; <i>prefix</i>, const QString &amp; <i>fieldSep</i>, const QString &amp; <i>sep</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="q3sqlcursor.html#update-2">update</a></b> ( const QString &amp; <i>filter</i>, bool <i>invalidate</i> = true )</td></tr>
</table>
<a name="details"></a>
<!-- $$$Q3SqlCursor-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The Q3SqlCursor class provides browsing and editing of SQL tables and views.</p>
<p>A Q3SqlCursor is a database record (see <a href="qsqlrecord.html">QSqlRecord</a>) that corresponds to a table or view within an SQL database (see <a href="qsqldatabase.html">QSqlDatabase</a>). There are two buffers in a cursor, one used for browsing and one used for editing records. Each buffer contains a list of fields which correspond to the fields in the table or view.</p>
<p>When positioned on a valid record, the browse buffer contains the values of the current record's fields from the database. The edit buffer is separate, and is used for editing existing records and inserting new records.</p>
<p>For browsing data, a cursor must first <a href="q3sqlcursor.html#select">select</a>() data from the database. After a successful <a href="q3sqlcursor.html#select">select</a>() the cursor is active (<a href="qsqlquery.html#isActive">isActive</a>() returns true), but is initially not positioned on a valid record (<a href="qsqlquery.html#isValid">isValid</a>() returns false). To position the cursor on a valid record, use one of the navigation functions, next(), previous(), first(), last(), or seek(). Once positioned on a valid record, data can be retrieved from the browse buffer using <a href="q3sqlcursor.html#value">value</a>(). If a navigation function is not successful, it returns false, the cursor will no longer be positioned on a valid record and the values returned by <a href="q3sqlcursor.html#value">value</a>() are undefined.</p>
<p>For example:</p>
<pre class="cpp"> <span class="type">Q3SqlCursor</span> cur( <span class="string">&quot;staff&quot;</span> ); <span class="comment">// Specify the table/view name</span>
 cur<span class="operator">.</span><a href="q3sqlcursor.html#select">select</a>(); <span class="comment">// We'll retrieve every record</span>
 <span class="keyword">while</span> ( cur<span class="operator">.</span>next() ) {
     <a href="qtglobal.html#qDebug">qDebug</a>( cur<span class="operator">.</span>value( <span class="string">&quot;id&quot;</span> )<span class="operator">.</span>toString() <span class="operator">+</span> <span class="string">&quot;: &quot;</span> <span class="operator">+</span>
     cur<span class="operator">.</span>value( <span class="string">&quot;surname&quot;</span> )<span class="operator">.</span>toString() <span class="operator">+</span> <span class="char">' '</span> <span class="operator">+</span>
     cur<span class="operator">.</span>value( <span class="string">&quot;salary&quot;</span> )<span class="operator">.</span>toString() );
 }</pre>
<p>In the above example, a cursor is created specifying a table or view name in the database. Then, <a href="q3sqlcursor.html#select">select</a>() is called, which can be optionally parameterised to filter and order the records retrieved. Each record in the cursor is retrieved using next(). When next() returns false, there are no more records to process, and the loop terminates.</p>
<p>For editing records (rows of data), a cursor contains a separate edit buffer which is independent of the fields used when browsing. The functions <a href="q3sqlcursor.html#insert">insert</a>(), <a href="q3sqlcursor.html#update">update</a>() and <a href="q3sqlcursor.html#del">del</a>() operate on the edit buffer. This allows the cursor to be repositioned to other records while simultaneously maintaining a separate buffer for edits. You can get a pointer to the edit buffer using <a href="q3sqlcursor.html#editBuffer">editBuffer</a>(). The <a href="q3sqlcursor.html#primeInsert">primeInsert</a>(), <a href="q3sqlcursor.html#primeUpdate">primeUpdate</a>() and <a href="q3sqlcursor.html#primeDelete">primeDelete</a>() functions also return a pointer to the edit buffer and prepare it for insert, update and delete respectively. Edit operations only affect a single row at a time. Note that <a href="q3sqlcursor.html#update">update</a>() and <a href="q3sqlcursor.html#del">del</a>() require that the table or view contain a <a href="q3sqlcursor.html#primaryIndex">primaryIndex</a>() to ensure that edit operations affect a unique record within the database.</p>
<p>For example:</p>
<pre class="cpp"> <span class="type">Q3SqlCursor</span> cur( <span class="string">&quot;prices&quot;</span> );
 cur<span class="operator">.</span><a href="q3sqlcursor.html#select">select</a>( <span class="string">&quot;id=202&quot;</span> );
 <span class="keyword">if</span> ( cur<span class="operator">.</span>next() ) {
     <span class="type"><a href="qsqlrecord.html">QSqlRecord</a></span> <span class="operator">*</span>buffer <span class="operator">=</span> cur<span class="operator">.</span>primeUpdate();
     <span class="type">double</span> price <span class="operator">=</span> buffer<span class="operator">-</span><span class="operator">&gt;</span>value( <span class="string">&quot;price&quot;</span> )<span class="operator">.</span>toDouble();
     <span class="type">double</span> newprice <span class="operator">=</span> price <span class="operator">*</span> <span class="number">1.05</span>;
     buffer<span class="operator">-</span><span class="operator">&gt;</span>setValue( <span class="string">&quot;price&quot;</span><span class="operator">,</span> newprice );
     cur<span class="operator">.</span>update();
 }</pre>
<p>To edit an existing database record, first move to the record you wish to update. Call <a href="q3sqlcursor.html#primeUpdate">primeUpdate</a>() to get the pointer to the cursor's edit buffer. Then use this pointer to modify the values in the edit buffer. Finally, call <a href="q3sqlcursor.html#update">update</a>() to save the changes to the database. The values in the edit buffer will be used to locate the appropriate record when updating the database (see <a href="q3sqlcursor.html#primaryIndex">primaryIndex</a>()).</p>
<p>Similarly, when deleting an existing database record, first move to the record you wish to delete. Then, call <a href="q3sqlcursor.html#primeDelete">primeDelete</a>() to get the pointer to the edit buffer. Finally, call <a href="q3sqlcursor.html#del">del</a>() to delete the record from the database. Again, the values in the edit buffer will be used to locate and delete the appropriate record.</p>
<p>To insert a new record, call <a href="q3sqlcursor.html#primeInsert">primeInsert</a>() to get the pointer to the edit buffer. Use this pointer to populate the edit buffer with new values and then <a href="q3sqlcursor.html#insert">insert</a>() the record into the database.</p>
<p>After calling <a href="q3sqlcursor.html#insert">insert</a>(), <a href="q3sqlcursor.html#update">update</a>() or <a href="q3sqlcursor.html#del">del</a>(), the cursor is no longer positioned on a valid record and can no longer be navigated (<a href="qsqlquery.html#isValid">isValid</a>() return false). The reason for this is that any changes made to the database will not be visible until <a href="q3sqlcursor.html#select">select</a>() is called to refresh the cursor. You can change this behavior by passing false to <a href="q3sqlcursor.html#insert">insert</a>(), <a href="q3sqlcursor.html#update">update</a>() or <a href="q3sqlcursor.html#del">del</a>() which will prevent the cursor from becoming invalid. The edits will still not be visible when navigating the cursor until <a href="q3sqlcursor.html#select">select</a>() is called.</p>
<p>Q3SqlCursor contains virtual methods which allow editing behavior to be customized by subclasses. This allows custom cursors to be created that encapsulate the editing behavior of a database table for an entire application. For example, a cursor can be customized to always auto-number primary index fields, or provide fields with suitable default values, when inserting new records. Q3SqlCursor generates SQL statements which are sent to the database engine; you can control which fields are included in these statements using <a href="q3sqlcursor.html#setGenerated">setGenerated</a>().</p>
<p>Note that Q3SqlCursor does not inherit from <a href="qobject.html">QObject</a>. This means that you are responsible for destroying instances of this class yourself. However if you create a Q3SqlCursor and use it in a <a href="q3datatable.html">Q3DataTable</a>, <a href="q3databrowser.html">Q3DataBrowser</a> or a <a href="q3dataview.html">Q3DataView</a> these classes will usually take ownership of the cursor and destroy it when they don't need it anymore. The documentation for <a href="q3datatable.html">Q3DataTable</a>, <a href="q3databrowser.html">Q3DataBrowser</a> and <a href="q3dataview.html">Q3DataView</a> explicitly states which calls take ownership of the cursor.</p>
</div>
<!-- @@@Q3SqlCursor -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$Mode$$$ReadOnly$$$Insert$$$Update$$$Delete$$$Writable -->
<h3 class="fn"><a name="Mode-enum"></a>enum Q3SqlCursor::<span class="name">Mode</span></h3>
<p>This enum type describes how <a href="q3sqlcursor.html" class="compat">Q3SqlCursor</a> operates on records in the database.</p>
<table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><tt>Q3SqlCursor::ReadOnly</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">the cursor can only SELECT records from the database.</td></tr>
<tr><td class="topAlign"><tt>Q3SqlCursor::Insert</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign">the cursor can INSERT records into the database.</td></tr>
<tr><td class="topAlign"><tt>Q3SqlCursor::Update</tt></td><td class="topAlign"><tt>2</tt></td><td class="topAlign">the cursor can UPDATE records in the database.</td></tr>
<tr><td class="topAlign"><tt>Q3SqlCursor::Delete</tt></td><td class="topAlign"><tt>4</tt></td><td class="topAlign">the cursor can DELETE records from the database.</td></tr>
<tr><td class="topAlign"><tt>Q3SqlCursor::Writable</tt></td><td class="topAlign"><tt>7</tt></td><td class="topAlign">the cursor can INSERT, UPDATE and DELETE records in the database.</td></tr>
</table>
<!-- @@@Mode -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$Q3SqlCursor[overload1]$$$Q3SqlCursorconstQString&boolQSqlDatabase -->
<h3 class="fn"><a name="Q3SqlCursor"></a>Q3SqlCursor::<span class="name">Q3SqlCursor</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>name</i> = QString(), <span class="type">bool</span> <i>autopopulate</i> = true, <span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span> <i>db</i> = QSqlDatabase() )</h3>
<p>Constructs a cursor on database <i>db</i> using table or view <i>name</i>.</p>
<p>If <i>autopopulate</i> is true (the default), the <i>name</i> of the cursor must correspond to an existing table or view name in the database so that field information can be automatically created. If the table or view does not exist, the cursor will not be functional.</p>
<p>The cursor is created with an initial mode of <a href="q3sqlcursor.html#Mode-enum">Q3SqlCursor::Writable</a> (meaning that records can be inserted, updated or deleted using the cursor). If the cursor does not have a unique primary index, update and deletes cannot be performed.</p>
<p>Note that <i>autopopulate</i> refers to populating the cursor with meta-data, e.g&#x2e; the names of the table's fields, not with retrieving data. The <a href="q3sqlcursor.html#select">select</a>() function is used to populate the cursor with data.</p>
<p><b>See also </b><a href="q3sqlcursor.html#setName">setName</a>() and <a href="q3sqlcursor.html#setMode">setMode</a>().</p>
<!-- @@@Q3SqlCursor -->
<!-- $$$Q3SqlCursor$$$Q3SqlCursorconstQ3SqlCursor& -->
<h3 class="fn"><a name="Q3SqlCursor-2"></a>Q3SqlCursor::<span class="name">Q3SqlCursor</span> ( const <span class="type">Q3SqlCursor</span> &amp; <i>other</i> )</h3>
<p>Constructs a copy of <i>other</i>.</p>
<!-- @@@Q3SqlCursor -->
<!-- $$$~Q3SqlCursor[overload1]$$$~Q3SqlCursor -->
<h3 class="fn"><a name="dtor.Q3SqlCursor"></a>Q3SqlCursor::<span class="name">~Q3SqlCursor</span> ()<tt> [virtual]</tt></h3>
<p>Destroys the object and frees any allocated resources.</p>
<!-- @@@~Q3SqlCursor -->
<!-- $$$append[overload1]$$$appendconstQ3SqlFieldInfo& -->
<h3 class="fn"><a name="append"></a><span class="type">void</span> Q3SqlCursor::<span class="name">append</span> ( const <span class="type"><a href="q3sqlfieldinfo.html">Q3SqlFieldInfo</a></span> &amp; <i>fieldInfo</i> )<tt> [virtual]</tt></h3>
<p>Append a copy of field <i>fieldInfo</i> to the end of the cursor. Note that all references to the cursor edit buffer become invalidated.</p>
<!-- @@@append -->
<!-- $$$calculateField[overload1]$$$calculateFieldconstQString& -->
<h3 class="fn"><a name="calculateField"></a><span class="type"><a href="qvariant.html">QVariant</a></span> Q3SqlCursor::<span class="name">calculateField</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>name</i> )<tt> [virtual protected]</tt></h3>
<p>Protected virtual function which is called whenever a field needs to be calculated. If calculated fields are being used, derived classes must reimplement this function and return the appropriate value for field <i>name</i>. The default implementation returns an invalid <a href="qvariant.html">QVariant</a>.</p>
<p><b>See also </b><a href="q3sqlcursor.html#setCalculated">setCalculated</a>().</p>
<!-- @@@calculateField -->
<!-- $$$canDelete[overload1]$$$canDelete -->
<h3 class="fn"><a name="canDelete"></a><span class="type">bool</span> Q3SqlCursor::<span class="name">canDelete</span> () const</h3>
<p>Returns true if the cursor will perform deletes; otherwise returns false.</p>
<p><b>See also </b><a href="q3sqlcursor.html#setMode">setMode</a>().</p>
<!-- @@@canDelete -->
<!-- $$$canInsert[overload1]$$$canInsert -->
<h3 class="fn"><a name="canInsert"></a><span class="type">bool</span> Q3SqlCursor::<span class="name">canInsert</span> () const</h3>
<p>Returns true if the cursor will perform inserts; otherwise returns false.</p>
<p><b>See also </b><a href="q3sqlcursor.html#setMode">setMode</a>().</p>
<!-- @@@canInsert -->
<!-- $$$canUpdate[overload1]$$$canUpdate -->
<h3 class="fn"><a name="canUpdate"></a><span class="type">bool</span> Q3SqlCursor::<span class="name">canUpdate</span> () const</h3>
<p>Returns true if the cursor will perform updates; otherwise returns false.</p>
<p><b>See also </b><a href="q3sqlcursor.html#setMode">setMode</a>().</p>
<!-- @@@canUpdate -->
<!-- $$$clear[overload1]$$$clear -->
<h3 class="fn"><a name="clear"></a><span class="type">void</span> Q3SqlCursor::<span class="name">clear</span> ()<tt> [virtual]</tt></h3>
<p>Removes all fields from the cursor. Note that all references to the cursor edit buffer become invalidated.</p>
<!-- @@@clear -->
<!-- $$$del[overload1]$$$delbool -->
<h3 class="fn"><a name="del"></a><span class="type">int</span> Q3SqlCursor::<span class="name">del</span> ( <span class="type">bool</span> <i>invalidate</i> = true )<tt> [virtual]</tt></h3>
<p>Deletes a record from the database using the cursor's primary index and the contents of the cursor edit buffer. Returns the number of records which were deleted. For error information, use <a href="qsqlquery.html#lastError">lastError</a>().</p>
<p>Only records which meet the filter criteria specified by the cursor's primary index are deleted. If the cursor does not contain a primary index, no delete is performed and 0 is returned. If <i>invalidate</i> is true (the default), the current cursor can no longer be navigated. A new <a href="q3sqlcursor.html#select">select</a>() call must be made before you can move to a valid record. For example:</p>
<pre class="cpp"> <span class="type"><a href="q3sqlcursor.html">Q3SqlCursor</a></span> cur(<span class="string">&quot;prices&quot;</span>);
 cur<span class="operator">.</span><a href="q3sqlcursor.html#select">select</a>(<span class="string">&quot;id=999&quot;</span>);
 <span class="keyword">if</span> (cur<span class="operator">.</span>next()) {
     cur<span class="operator">.</span>primeDelete();
     cur<span class="operator">.</span>del();
 }</pre>
<p>In the above example, a cursor is created on the 'prices' table and positioned to the record to be deleted. First <a href="q3sqlcursor.html#primeDelete">primeDelete</a>() is called to populate the edit buffer with the current cursor values, e.g&#x2e; with an id of 999, and then del() is called to actually delete the record from the database. Remember: all edit operations (<a href="q3sqlcursor.html#insert">insert</a>(), <a href="q3sqlcursor.html#update">update</a>() and delete()) operate on the contents of the cursor edit buffer and not on the contents of the cursor itself.</p>
<p><b>See also </b><a href="q3sqlcursor.html#primeDelete">primeDelete</a>(), <a href="q3sqlcursor.html#setMode">setMode</a>(), and <a href="qsqlquery.html#lastError">lastError</a>().</p>
<!-- @@@del -->
<!-- $$$del$$$delconstQString&bool -->
<h3 class="fn"><a name="del-2"></a><span class="type">int</span> Q3SqlCursor::<span class="name">del</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>filter</i>, <span class="type">bool</span> <i>invalidate</i> = true )<tt> [virtual protected]</tt></h3>
<p>This is an overloaded function.</p>
<p>Deletes the current cursor record from the database using the filter <i>filter</i>. Only records which meet the filter criteria are deleted. Returns the number of records which were deleted. If <i>invalidate</i> is true (the default), the current cursor can no longer be navigated. A new <a href="q3sqlcursor.html#select">select</a>() call must be made before you can move to a valid record. For error information, use <a href="qsqlquery.html#lastError">lastError</a>().</p>
<p>The <i>filter</i> is an SQL <tt>WHERE</tt> clause, e.g&#x2e; <tt>id=500</tt>.</p>
<p><b>See also </b><a href="q3sqlcursor.html#setMode">setMode</a>() and <a href="qsqlquery.html#lastError">lastError</a>().</p>
<!-- @@@del -->
<!-- $$$editBuffer[overload1]$$$editBufferbool -->
<h3 class="fn"><a name="editBuffer"></a><span class="type"><a href="qsqlrecord.html">QSqlRecord</a></span> * Q3SqlCursor::<span class="name">editBuffer</span> ( <span class="type">bool</span> <i>copy</i> = false )<tt> [virtual]</tt></h3>
<p>Returns the current internal edit buffer. If <i>copy</i> is true (the default is false), the current cursor field values are first copied into the edit buffer. The edit buffer is valid as long as the cursor remains valid. The cursor retains ownership of the returned pointer, so it must not be deleted or modified.</p>
<p><b>See also </b><a href="q3sqlcursor.html#primeInsert">primeInsert</a>(), <a href="q3sqlcursor.html#primeUpdate">primeUpdate</a>(), and <a href="q3sqlcursor.html#primeDelete">primeDelete</a>().</p>
<!-- @@@editBuffer -->
<!-- $$$exec[overload1]$$$execconstQString& -->
<h3 class="fn"><a name="exec"></a><span class="type">bool</span> Q3SqlCursor::<span class="name">exec</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>sql</i> )<tt> [virtual protected]</tt></h3>
<p>Executes the SQL query <i>sql</i>. Returns true of the cursor is active, otherwise returns false.</p>
<!-- @@@exec -->
<!-- $$$filter[overload1]$$$filter -->
<h3 class="fn"><a name="filter"></a><span class="type"><a href="qstring.html">QString</a></span> Q3SqlCursor::<span class="name">filter</span> () const</h3>
<p>Returns the current filter, or an empty string if there is no current filter.</p>
<p><b>See also </b><a href="q3sqlcursor.html#setFilter">setFilter</a>().</p>
<!-- @@@filter -->
<!-- $$$index[overload1]$$$indexconstQStringList& -->
<h3 class="fn"><a name="index"></a><span class="type"><a href="qsqlindex.html">QSqlIndex</a></span> Q3SqlCursor::<span class="name">index</span> ( const <span class="type"><a href="qstringlist.html">QStringList</a></span> &amp; <i>fieldNames</i> ) const<tt> [virtual]</tt></h3>
<p>Returns an index composed of <i>fieldNames</i>, all in ASCending order. Note that all field names must exist in the cursor, otherwise an empty index is returned.</p>
<p><b>See also </b><a href="qsqlindex.html">QSqlIndex</a>.</p>
<!-- @@@index -->
<!-- $$$index$$$indexconstQString& -->
<h3 class="fn"><a name="index-2"></a><span class="type"><a href="qsqlindex.html">QSqlIndex</a></span> Q3SqlCursor::<span class="name">index</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fieldName</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns an index based on <i>fieldName</i>.</p>
<!-- @@@index -->
<!-- $$$insert[overload1]$$$insertintconstQ3SqlFieldInfo& -->
<h3 class="fn"><a name="insert"></a><span class="type">void</span> Q3SqlCursor::<span class="name">insert</span> ( <span class="type">int</span> <i>pos</i>, const <span class="type"><a href="q3sqlfieldinfo.html">Q3SqlFieldInfo</a></span> &amp; <i>fieldInfo</i> )<tt> [virtual]</tt></h3>
<p>Insert a copy of <i>fieldInfo</i> at position <i>pos</i>. If a field already exists at <i>pos</i>, it is removed. Note that all references to the cursor edit buffer become invalidated.</p>
<!-- @@@insert -->
<!-- $$$insert$$$insertbool -->
<h3 class="fn"><a name="insert-2"></a><span class="type">int</span> Q3SqlCursor::<span class="name">insert</span> ( <span class="type">bool</span> <i>invalidate</i> = true )<tt> [virtual]</tt></h3>
<p>Inserts the current contents of the cursor's edit record buffer into the database, if the cursor allows inserts. Returns the number of rows affected by the insert. For error information, use <a href="qsqlquery.html#lastError">lastError</a>().</p>
<p>If <i>invalidate</i> is true (the default), the cursor will no longer be positioned on a valid record and can no longer be navigated. A new <a href="q3sqlcursor.html#select">select</a>() call must be made before navigating to a valid record.</p>
<pre class="cpp"> <span class="type"><a href="q3sqlcursor.html">Q3SqlCursor</a></span> cur(<span class="string">&quot;prices&quot;</span>);
 <span class="type"><a href="qsqlrecord.html">QSqlRecord</a></span> <span class="operator">*</span>buffer <span class="operator">=</span> cur<span class="operator">.</span><a href="q3sqlcursor.html#primeInsert">primeInsert</a>();
 buffer<span class="operator">-</span><span class="operator">&gt;</span><a href="q3sqlcursor.html#setValue">setValue</a>(<span class="string">&quot;id&quot;</span><span class="operator">,</span>    <span class="number">53981</span>);
 buffer<span class="operator">-</span><span class="operator">&gt;</span><a href="q3sqlcursor.html#setValue">setValue</a>(<span class="string">&quot;name&quot;</span><span class="operator">,</span>  <span class="string">&quot;Thingy&quot;</span>);
 buffer<span class="operator">-</span><span class="operator">&gt;</span><a href="q3sqlcursor.html#setValue">setValue</a>(<span class="string">&quot;price&quot;</span><span class="operator">,</span> <span class="number">105.75</span>);
 cur<span class="operator">.</span><a href="q3sqlcursor.html#insert">insert</a>();</pre>
<p>In the above example, a cursor is created on the 'prices' table and a pointer to the insert buffer is acquired using <a href="q3sqlcursor.html#primeInsert">primeInsert</a>(). Each field's value is set to the desired value and then <a href="q3sqlcursor.html#insert">insert</a>() is called to insert the data into the database. Remember: all edit operations (<a href="q3sqlcursor.html#insert">insert</a>(), <a href="q3sqlcursor.html#update">update</a>() and delete()) operate on the contents of the cursor edit buffer and not on the contents of the cursor itself.</p>
<p><b>See also </b><a href="q3sqlcursor.html#setMode">setMode</a>() and <a href="qsqlquery.html#lastError">lastError</a>().</p>
<!-- @@@insert -->
<!-- $$$isCalculated[overload1]$$$isCalculatedconstQString& -->
<h3 class="fn"><a name="isCalculated"></a><span class="type">bool</span> Q3SqlCursor::<span class="name">isCalculated</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>name</i> ) const</h3>
<p>Returns true if the field <i>name</i> exists and is calculated; otherwise returns false.</p>
<p><b>See also </b><a href="q3sqlcursor.html#setCalculated">setCalculated</a>().</p>
<!-- @@@isCalculated -->
<!-- $$$isNull[overload1]$$$isNullint -->
<h3 class="fn"><a name="isNull"></a><span class="type">bool</span> Q3SqlCursor::<span class="name">isNull</span> ( <span class="type">int</span> <i>i</i> ) const</h3>
<p>Returns true if the field <i>i</i> is NULL or if there is no field at position <i>i</i>; otherwise returns false.</p>
<p>This is the same as calling QSqlRecord::isNull(<i>i</i>)</p>
<!-- @@@isNull -->
<!-- $$$isNull$$$isNullconstQString& -->
<h3 class="fn"><a name="isNull-2"></a><span class="type">bool</span> Q3SqlCursor::<span class="name">isNull</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>name</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns true if the field called <i>name</i> is NULL or if there is no field called <i>name</i>; otherwise returns false.</p>
<p>This is the same as calling QSqlRecord::isNull(<i>name</i>)</p>
<!-- @@@isNull -->
<!-- $$$isReadOnly[overload1]$$$isReadOnly -->
<h3 class="fn"><a name="isReadOnly"></a><span class="type">bool</span> Q3SqlCursor::<span class="name">isReadOnly</span> () const</h3>
<p>Returns true if the cursor is read-only; otherwise returns false. The default is false. Read-only cursors cannot be edited using <a href="q3sqlcursor.html#insert">insert</a>(), <a href="q3sqlcursor.html#update">update</a>() or <a href="q3sqlcursor.html#del">del</a>().</p>
<p><b>See also </b><a href="q3sqlcursor.html#setMode">setMode</a>().</p>
<!-- @@@isReadOnly -->
<!-- $$$isTrimmed[overload1]$$$isTrimmedconstQString& -->
<h3 class="fn"><a name="isTrimmed"></a><span class="type">bool</span> Q3SqlCursor::<span class="name">isTrimmed</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>name</i> ) const</h3>
<p>Returns true if the field <i>name</i> exists and is trimmed; otherwise returns false.</p>
<p>When a trimmed field of type string or cstring is read from the database any trailing (right-most) spaces are removed.</p>
<p><b>See also </b><a href="q3sqlcursor.html#setTrimmed">setTrimmed</a>().</p>
<!-- @@@isTrimmed -->
<!-- $$$mode[overload1]$$$mode -->
<h3 class="fn"><a name="mode"></a><span class="type">int</span> Q3SqlCursor::<span class="name">mode</span> () const</h3>
<p>Returns the current cursor mode.</p>
<p><b>See also </b><a href="q3sqlcursor.html#setMode">setMode</a>().</p>
<!-- @@@mode -->
<!-- $$$name[overload1]$$$name -->
<h3 class="fn"><a name="name"></a><span class="type"><a href="qstring.html">QString</a></span> Q3SqlCursor::<span class="name">name</span> () const</h3>
<p>Returns the name of the cursor.</p>
<p><b>See also </b><a href="q3sqlcursor.html#setName">setName</a>().</p>
<!-- @@@name -->
<!-- $$$primaryIndex[overload1]$$$primaryIndexbool -->
<h3 class="fn"><a name="primaryIndex"></a><span class="type"><a href="qsqlindex.html">QSqlIndex</a></span> Q3SqlCursor::<span class="name">primaryIndex</span> ( <span class="type">bool</span> <i>setFromCursor</i> = true ) const<tt> [virtual]</tt></h3>
<p>Returns the primary index associated with the cursor as defined in the database, or an empty index if there is no primary index. If <i>setFromCursor</i> is true (the default), the index fields are populated with the corresponding values in the cursor's current record.</p>
<p><b>See also </b><a href="q3sqlcursor.html#setPrimaryIndex">setPrimaryIndex</a>().</p>
<!-- @@@primaryIndex -->
<!-- $$$primeDelete[overload1]$$$primeDelete -->
<h3 class="fn"><a name="primeDelete"></a><span class="type"><a href="qsqlrecord.html">QSqlRecord</a></span> * Q3SqlCursor::<span class="name">primeDelete</span> ()<tt> [virtual]</tt></h3>
<p>This function primes the edit buffer's field values for delete and returns the edit buffer. The default implementation copies the field values from the current cursor record into the edit buffer (therefore, this function is equivalent to calling editBuffer( true)). The cursor retains ownership of the returned pointer, so it must not be deleted or modified.</p>
<p><b>See also </b><a href="q3sqlcursor.html#editBuffer">editBuffer</a>() and <a href="q3sqlcursor.html#del">del</a>().</p>
<!-- @@@primeDelete -->
<!-- $$$primeInsert[overload1]$$$primeInsert -->
<h3 class="fn"><a name="primeInsert"></a><span class="type"><a href="qsqlrecord.html">QSqlRecord</a></span> * Q3SqlCursor::<span class="name">primeInsert</span> ()<tt> [virtual]</tt></h3>
<p>This function primes the edit buffer's field values for insert and returns the edit buffer. The default implementation clears all field values in the edit buffer. The cursor retains ownership of the returned pointer, so it must not be deleted or modified.</p>
<p><b>See also </b><a href="q3sqlcursor.html#editBuffer">editBuffer</a>() and <a href="q3sqlcursor.html#insert">insert</a>().</p>
<!-- @@@primeInsert -->
<!-- $$$primeUpdate[overload1]$$$primeUpdate -->
<h3 class="fn"><a name="primeUpdate"></a><span class="type"><a href="qsqlrecord.html">QSqlRecord</a></span> * Q3SqlCursor::<span class="name">primeUpdate</span> ()<tt> [virtual]</tt></h3>
<p>This function primes the edit buffer's field values for update and returns the edit buffer. The default implementation copies the field values from the current cursor record into the edit buffer (therefore, this function is equivalent to calling editBuffer( true)). The cursor retains ownership of the returned pointer, so it must not be deleted or modified.</p>
<p><b>See also </b><a href="q3sqlcursor.html#editBuffer">editBuffer</a>() and <a href="q3sqlcursor.html#update">update</a>().</p>
<!-- @@@primeUpdate -->
<!-- $$$remove[overload1]$$$removeint -->
<h3 class="fn"><a name="remove"></a><span class="type">void</span> Q3SqlCursor::<span class="name">remove</span> ( <span class="type">int</span> <i>pos</i> )<tt> [virtual]</tt></h3>
<p>Removes the field at <i>pos</i>. If <i>pos</i> does not exist, nothing happens. Note that all references to the cursor edit buffer become invalidated.</p>
<!-- @@@remove -->
<!-- $$$select[overload1]$$$selectconstQString&constQSqlIndex& -->
<h3 class="fn"><a name="select"></a><span class="type">bool</span> Q3SqlCursor::<span class="name">select</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>filter</i>, const <span class="type"><a href="qsqlindex.html">QSqlIndex</a></span> &amp; <i>sort</i> = QSqlIndex() )<tt> [virtual]</tt></h3>
<p>Selects all fields in the cursor from the database matching the filter criteria <i>filter</i>. The data is returned in the order specified by the index <i>sort</i>. Returns true if the data was successfully selected; otherwise returns false.</p>
<p>The <i>filter</i> is a string containing a SQL <tt>WHERE</tt> clause but without the 'WHERE' keyword. The cursor is initially positioned at an invalid row after this function is called. To move to a valid row, use seek(), first(), last(), previous() or next().</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="q3sqlcursor.html">Q3SqlCursor</a></span> cur(<span class="string">&quot;Employee&quot;</span>); <span class="comment">// Use the Employee table or view</span>
 cur<span class="operator">.</span>select(<span class="string">&quot;deptno=10&quot;</span>); <span class="comment">// select all records in department 10</span>
 <span class="keyword">while</span>(cur<span class="operator">.</span>next()) {
     <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span> <span class="comment">// process data</span>
 }
 <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 <span class="comment">// select records in other departments, ordered by department number</span>
 cur<span class="operator">.</span>select(<span class="string">&quot;deptno&gt;10&quot;</span><span class="operator">,</span> cur<span class="operator">.</span>index(<span class="string">&quot;deptno&quot;</span>));
 <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span></pre>
<p>The filter will apply to any subsequent select() calls that do not explicitly specify another filter. Similarly the sort will apply to any subsequent select() calls that do not explicitly specify another sort.</p>
<pre class="cpp"> <span class="type"><a href="q3sqlcursor.html">Q3SqlCursor</a></span> cur(<span class="string">&quot;Employee&quot;</span>);
 cur<span class="operator">.</span>select(<span class="string">&quot;deptno=10&quot;</span>); <span class="comment">// select all records in department 10</span>
 <span class="keyword">while</span>(cur<span class="operator">.</span>next()) {
     <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span> <span class="comment">// process data</span>
 }
 <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 cur<span class="operator">.</span>select(); <span class="comment">// re-selects all records in department 10</span>
 <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span></pre>
<!-- @@@select -->
<!-- $$$select$$$select -->
<h3 class="fn"><a name="select-2"></a><span class="type">bool</span> Q3SqlCursor::<span class="name">select</span> ()</h3>
<p>This is an overloaded function.</p>
<p>Selects all fields in the cursor from the database. The rows are returned in the order specified by the last call to <a href="q3sqlcursor.html#setSort">setSort</a>() or the last call to <a href="q3sqlcursor.html#select">select</a>() that specified a sort, whichever is the most recent. If there is no current sort, the order in which the rows are returned is undefined. The records are filtered according to the filter specified by the last call to <a href="q3sqlcursor.html#setFilter">setFilter</a>() or the last call to <a href="q3sqlcursor.html#select">select</a>() that specified a filter, whichever is the most recent. If there is no current filter, all records are returned. The cursor is initially positioned at an invalid row. To move to a valid row, use seek(), first(), last(), previous() or next().</p>
<p><b>See also </b><a href="q3sqlcursor.html#setSort">setSort</a>() and <a href="q3sqlcursor.html#setFilter">setFilter</a>().</p>
<!-- @@@select -->
<!-- $$$select$$$selectconstQSqlIndex& -->
<h3 class="fn"><a name="select-3"></a><span class="type">bool</span> Q3SqlCursor::<span class="name">select</span> ( const <span class="type"><a href="qsqlindex.html">QSqlIndex</a></span> &amp; <i>sort</i> )</h3>
<p>This is an overloaded function.</p>
<p>Selects all fields in the cursor from the database. The data is returned in the order specified by the index <i>sort</i>. The records are filtered according to the filter specified by the last call to <a href="q3sqlcursor.html#setFilter">setFilter</a>() or the last call to <a href="q3sqlcursor.html#select">select</a>() that specified a filter, whichever is the most recent. The cursor is initially positioned at an invalid row. To move to a valid row, use seek(), first(), last(), previous() or next().</p>
<!-- @@@select -->
<!-- $$$select$$$selectconstQSqlIndex&constQSqlIndex& -->
<h3 class="fn"><a name="select-4"></a><span class="type">bool</span> Q3SqlCursor::<span class="name">select</span> ( const <span class="type"><a href="qsqlindex.html">QSqlIndex</a></span> &amp; <i>filter</i>, const <span class="type"><a href="qsqlindex.html">QSqlIndex</a></span> &amp; <i>sort</i> )</h3>
<p>This is an overloaded function.</p>
<p>Selects all fields in the cursor matching the filter index <i>filter</i>. The data is returned in the order specified by the index <i>sort</i>. The <i>filter</i> index works by constructing a WHERE clause using the names of the fields from the <i>filter</i> and their values from the current cursor record. The cursor is initially positioned at an invalid row. To move to a valid row, use seek(), first(), last(), previous() or next(). This function is useful, for example, for retrieving data based upon a table's primary index:</p>
<pre class="cpp"> <span class="type"><a href="q3sqlcursor.html">Q3SqlCursor</a></span> cur(<span class="string">&quot;Employee&quot;</span>);
 <span class="type"><a href="qsqlindex.html">QSqlIndex</a></span> pk <span class="operator">=</span> cur<span class="operator">.</span><a href="q3sqlcursor.html#primaryIndex">primaryIndex</a>();
 cur<span class="operator">.</span><a href="q3sqlcursor.html#setValue">setValue</a>(<span class="string">&quot;id&quot;</span><span class="operator">,</span> <span class="number">10</span>);
 cur<span class="operator">.</span><a href="q3sqlcursor.html#select">select</a>(pk<span class="operator">,</span> pk); <span class="comment">// generates &quot;SELECT ... FROM Employee WHERE id=10 ORDER BY id&quot;</span>
 <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span></pre>
<p>In this example the <a href="qsqlindex.html">QSqlIndex</a>, pk, is used for two different purposes. When used as the filter (first) argument, the field names it contains are used to construct the WHERE clause, each set to the current cursor value, <tt>WHERE id=10</tt>, in this case. When used as the sort (second) argument the field names it contains are used for the ORDER BY clause, <tt>ORDER BY id</tt> in this example.</p>
<!-- @@@select -->
<!-- $$$setCalculated[overload1]$$$setCalculatedconstQString&bool -->
<h3 class="fn"><a name="setCalculated"></a><span class="type">void</span> Q3SqlCursor::<span class="name">setCalculated</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>name</i>, <span class="type">bool</span> <i>calculated</i> )<tt> [virtual]</tt></h3>
<p>Sets field <i>name</i> to <i>calculated</i>. If the field <i>name</i> does not exist, nothing happens. The value of a calculated field is set by the <a href="q3sqlcursor.html#calculateField">calculateField</a>() virtual function which you must reimplement (or the field value will be an invalid <a href="qvariant.html">QVariant</a>). Calculated fields do not appear in generated SQL statements sent to the database.</p>
<p><b>See also </b><a href="q3sqlcursor.html#isCalculated">isCalculated</a>() and <a href="q3sqlcursor.html#calculateField">calculateField</a>().</p>
<!-- @@@setCalculated -->
<!-- $$$setFilter[overload1]$$$setFilterconstQString& -->
<h3 class="fn"><a name="setFilter"></a><span class="type">void</span> Q3SqlCursor::<span class="name">setFilter</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>filter</i> )<tt> [virtual]</tt></h3>
<p>Sets the current filter to <i>filter</i>. Note that no new records are selected. To select new records, use <a href="q3sqlcursor.html#select">select</a>(). The <i>filter</i> will apply to any subsequent <a href="q3sqlcursor.html#select">select</a>() calls that do not explicitly specify a filter.</p>
<p>The filter is a SQL <tt>WHERE</tt> clause without the keyword 'WHERE', e.g&#x2e; <tt>name='Dave'</tt> which will be processed by the DBMS.</p>
<p><b>See also </b><a href="q3sqlcursor.html#filter">filter</a>().</p>
<!-- @@@setFilter -->
<!-- $$$setGenerated[overload1]$$$setGeneratedconstQString&bool -->
<h3 class="fn"><a name="setGenerated"></a><span class="type">void</span> Q3SqlCursor::<span class="name">setGenerated</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>name</i>, <span class="type">bool</span> <i>generated</i> )<tt> [virtual]</tt></h3>
<p>Sets the generated flag for the field <i>name</i> to <i>generated</i>. If the field does not exist, nothing happens. Only fields that have <i>generated</i> set to true are included in the SQL that is generated by <a href="q3sqlcursor.html#insert">insert</a>(), <a href="q3sqlcursor.html#update">update</a>() or <a href="q3sqlcursor.html#del">del</a>().</p>
<!-- @@@setGenerated -->
<!-- $$$setGenerated$$$setGeneratedintbool -->
<h3 class="fn"><a name="setGenerated-2"></a><span class="type">void</span> Q3SqlCursor::<span class="name">setGenerated</span> ( <span class="type">int</span> <i>i</i>, <span class="type">bool</span> <i>generated</i> )<tt> [virtual]</tt></h3>
<p>This is an overloaded function.</p>
<p>Sets the generated flag for the field <i>i</i> to <i>generated</i>.</p>
<!-- @@@setGenerated -->
<!-- $$$setMode[overload1]$$$setModeint -->
<h3 class="fn"><a name="setMode"></a><span class="type">void</span> Q3SqlCursor::<span class="name">setMode</span> ( <span class="type">int</span> <i>mode</i> )<tt> [virtual]</tt></h3>
<p>Sets the cursor mode to <i>mode</i>. This value can be an OR'ed combination of <a href="q3sqlcursor.html#Mode-enum">Q3SqlCursor::Mode</a> values. The default mode for a cursor is <a href="q3sqlcursor.html#Mode-enum">Q3SqlCursor::Writable</a>.</p>
<pre class="cpp"> <span class="type"><a href="q3sqlcursor.html">Q3SqlCursor</a></span> cur(<span class="string">&quot;Employee&quot;</span>);
 cur<span class="operator">.</span>setMode(<span class="type"><a href="q3sqlcursor.html">Q3SqlCursor</a></span><span class="operator">::</span>Writable); <span class="comment">// allow insert/update/delete</span>
 <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 cur<span class="operator">.</span>setMode(<span class="type"><a href="q3sqlcursor.html">Q3SqlCursor</a></span><span class="operator">::</span>Insert <span class="operator">|</span> <span class="type"><a href="q3sqlcursor.html">Q3SqlCursor</a></span><span class="operator">::</span>Update); <span class="comment">// allow inserts and updates only</span>
 <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
 cur<span class="operator">.</span>setMode(<span class="type"><a href="q3sqlcursor.html">Q3SqlCursor</a></span><span class="operator">::</span>ReadOnly); <span class="comment">// no inserts/updates/deletes allowed</span></pre>
<p><b>See also </b><a href="q3sqlcursor.html#mode">mode</a>().</p>
<!-- @@@setMode -->
<!-- $$$setName[overload1]$$$setNameconstQString&bool -->
<h3 class="fn"><a name="setName"></a><span class="type">void</span> Q3SqlCursor::<span class="name">setName</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>name</i>, <span class="type">bool</span> <i>autopopulate</i> = true )<tt> [virtual]</tt></h3>
<p>Sets the name of the cursor to <i>name</i>. If <i>autopopulate</i> is true (the default), the <i>name</i> must correspond to a valid table or view name in the database. Also, note that all references to the cursor edit buffer become invalidated when fields are auto-populated. See the <a href="q3sqlcursor.html" class="compat">Q3SqlCursor</a> constructor documentation for more information.</p>
<p><b>See also </b><a href="q3sqlcursor.html#name">name</a>().</p>
<!-- @@@setName -->
<!-- $$$setPrimaryIndex[overload1]$$$setPrimaryIndexconstQSqlIndex& -->
<h3 class="fn"><a name="setPrimaryIndex"></a><span class="type">void</span> Q3SqlCursor::<span class="name">setPrimaryIndex</span> ( const <span class="type"><a href="qsqlindex.html">QSqlIndex</a></span> &amp; <i>idx</i> )<tt> [virtual]</tt></h3>
<p>Sets the primary index associated with the cursor to the index <i>idx</i>. Note that this index must contain a field or set of fields which identify a unique record within the underlying database table or view so that <a href="q3sqlcursor.html#update">update</a>() and <a href="q3sqlcursor.html#del">del</a>() will execute as expected.</p>
<p><b>See also </b><a href="q3sqlcursor.html#primaryIndex">primaryIndex</a>(), <a href="q3sqlcursor.html#update">update</a>(), and <a href="q3sqlcursor.html#del">del</a>().</p>
<!-- @@@setPrimaryIndex -->
<!-- $$$setSort[overload1]$$$setSortconstQSqlIndex& -->
<h3 class="fn"><a name="setSort"></a><span class="type">void</span> Q3SqlCursor::<span class="name">setSort</span> ( const <span class="type"><a href="qsqlindex.html">QSqlIndex</a></span> &amp; <i>sort</i> )<tt> [virtual]</tt></h3>
<p>Sets the current sort to <i>sort</i>. Note that no new records are selected. To select new records, use <a href="q3sqlcursor.html#select">select</a>(). The <i>sort</i> will apply to any subsequent <a href="q3sqlcursor.html#select">select</a>() calls that do not explicitly specify a sort.</p>
<p><b>See also </b><a href="q3sqlcursor.html#sort">sort</a>().</p>
<!-- @@@setSort -->
<!-- $$$setTrimmed[overload1]$$$setTrimmedconstQString&bool -->
<h3 class="fn"><a name="setTrimmed"></a><span class="type">void</span> Q3SqlCursor::<span class="name">setTrimmed</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>name</i>, <span class="type">bool</span> <i>trim</i> )<tt> [virtual]</tt></h3>
<p>Sets field <i>name</i>'s trimmed status to <i>trim</i>. If the field <i>name</i> does not exist, nothing happens.</p>
<p>When a trimmed field of type string is read from the database any trailing (right-most) spaces are removed.</p>
<p><b>See also </b><a href="q3sqlcursor.html#isTrimmed">isTrimmed</a>() and <a href="qvariant.html">QVariant</a>.</p>
<!-- @@@setTrimmed -->
<!-- $$$setValue[overload1]$$$setValueconstQString&constQVariant& -->
<h3 class="fn"><a name="setValue"></a><span class="type">void</span> Q3SqlCursor::<span class="name">setValue</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>name</i>, const <span class="type"><a href="qvariant.html">QVariant</a></span> &amp; <i>val</i> )</h3>
<p>This is an overloaded function.</p>
<p>Sets the value for the field named <i>name</i> to <i>val</i>.</p>
<p><b>See also </b><a href="q3sqlcursor.html#value">value</a>().</p>
<!-- @@@setValue -->
<!-- $$$sort[overload1]$$$sort -->
<h3 class="fn"><a name="sort"></a><span class="type"><a href="qsqlindex.html">QSqlIndex</a></span> Q3SqlCursor::<span class="name">sort</span> () const</h3>
<p>Returns the current sort, or an empty index if there is no current sort.</p>
<p><b>See also </b><a href="q3sqlcursor.html#setSort">setSort</a>().</p>
<!-- @@@sort -->
<!-- $$$toString[overload1]$$$toStringQSqlRecord*constQString&constQString&constQString& -->
<h3 class="fn"><a name="toString"></a><span class="type"><a href="qstring.html">QString</a></span> Q3SqlCursor::<span class="name">toString</span> ( <span class="type"><a href="qsqlrecord.html">QSqlRecord</a></span> * <i>rec</i>, const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>prefix</i>, const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fieldSep</i>, const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>sep</i> ) const<tt> [virtual protected]</tt></h3>
<p>Returns a formatted string composed of all the fields in <i>rec</i>. Each field is composed of the <i>prefix</i> (e.g&#x2e; table or view name), &quot;.&quot;, the field name, the <i>fieldSep</i> and the field value. If the <i>prefix</i> is empty then each field will begin with the field name. The fields are then joined together separated by <i>sep</i>. Fields where <a href="qsqlrecord.html#isGenerated">isGenerated</a>() returns false are not included. This function is useful for generating SQL statements.</p>
<!-- @@@toString -->
<!-- $$$toString$$$toStringconstQString&QSqlField*constQString& -->
<h3 class="fn"><a name="toString-3"></a><span class="type"><a href="qstring.html">QString</a></span> Q3SqlCursor::<span class="name">toString</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>prefix</i>, <span class="type"><a href="qsqlfield.html">QSqlField</a></span> * <i>field</i>, const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fieldSep</i> ) const<tt> [virtual protected]</tt></h3>
<p>This is an overloaded function.</p>
<p>Returns a formatted string composed of the <i>prefix</i> (e.g&#x2e; table or view name), &quot;.&quot;, the <i>field</i> name, the <i>fieldSep</i> and the field value. If the <i>prefix</i> is empty then the string will begin with the <i>field</i> name. This function is useful for generating SQL statements.</p>
<!-- @@@toString -->
<!-- $$$toString$$$toStringconstQSqlIndex&QSqlRecord*constQString&constQString&constQString& -->
<h3 class="fn"><a name="toString-4"></a><span class="type"><a href="qstring.html">QString</a></span> Q3SqlCursor::<span class="name">toString</span> ( const <span class="type"><a href="qsqlindex.html">QSqlIndex</a></span> &amp; <i>i</i>, <span class="type"><a href="qsqlrecord.html">QSqlRecord</a></span> * <i>rec</i>, const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>prefix</i>, const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fieldSep</i>, const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>sep</i> ) const<tt> [virtual protected]</tt></h3>
<p>This is an overloaded function.</p>
<p>Returns a formatted string composed of all the fields in the index <i>i</i>. Each field is composed of the <i>prefix</i> (e.g&#x2e; table or view name), &quot;.&quot;, the field name, the <i>fieldSep</i> and the field value. If the <i>prefix</i> is empty then each field will begin with the field name. The field values are taken from <i>rec</i>. The fields are then joined together separated by <i>sep</i>. Fields where <a href="qsqlrecord.html#isGenerated">isGenerated</a>() returns false are ignored. This function is useful for generating SQL statements.</p>
<!-- @@@toString -->
<!-- $$$update[overload1]$$$updatebool -->
<h3 class="fn"><a name="update"></a><span class="type">int</span> Q3SqlCursor::<span class="name">update</span> ( <span class="type">bool</span> <i>invalidate</i> = true )<tt> [virtual]</tt></h3>
<p>Updates the database with the current contents of the edit buffer. Returns the number of records which were updated. For error information, use <a href="qsqlquery.html#lastError">lastError</a>().</p>
<p>Only records which meet the filter criteria specified by the cursor's primary index are updated. If the cursor does not contain a primary index, no update is performed and 0 is returned.</p>
<p>If <i>invalidate</i> is true (the default), the current cursor can no longer be navigated. A new <a href="q3sqlcursor.html#select">select</a>() call must be made before you can move to a valid record. For example:</p>
<pre class="cpp"> <span class="type"><a href="q3sqlcursor.html">Q3SqlCursor</a></span> cur(<span class="string">&quot;prices&quot;</span>);
 cur<span class="operator">.</span><a href="q3sqlcursor.html#select">select</a>(<span class="string">&quot;id=202&quot;</span>);
 <span class="keyword">if</span> (cur<span class="operator">.</span>next()) {
     <span class="type"><a href="qsqlrecord.html">QSqlRecord</a></span> <span class="operator">*</span>buffer <span class="operator">=</span> cur<span class="operator">.</span>primeUpdate();
     <span class="type">double</span> price <span class="operator">=</span> buffer<span class="operator">-</span><span class="operator">&gt;</span>value(<span class="string">&quot;price&quot;</span>)<span class="operator">.</span>toDouble();
     <span class="type">double</span> newprice <span class="operator">=</span> price <span class="operator">*</span> <span class="number">1.05</span>;
     buffer<span class="operator">-</span><span class="operator">&gt;</span>setValue(<span class="string">&quot;price&quot;</span><span class="operator">,</span> newprice);
     cur<span class="operator">.</span>update();
 }</pre>
<p>In the above example, a cursor is created on the 'prices' table and is positioned on the record to be updated. Then a pointer to the cursor's edit buffer is acquired using <a href="q3sqlcursor.html#primeUpdate">primeUpdate</a>(). A new value is calculated and placed into the edit buffer with the <a href="q3sqlcursor.html#setValue">setValue</a>() call. Finally, an update() call is made on the cursor which uses the tables's primary index to update the record in the database with the contents of the cursor's edit buffer. Remember: all edit operations (<a href="q3sqlcursor.html#insert">insert</a>(), update() and delete()) operate on the contents of the cursor edit buffer and not on the contents of the cursor itself.</p>
<p>Note that if the primary index does not uniquely distinguish records the database may be changed into an inconsistent state.</p>
<p><b>See also </b><a href="q3sqlcursor.html#setMode">setMode</a>() and <a href="qsqlquery.html#lastError">lastError</a>().</p>
<!-- @@@update -->
<!-- $$$update$$$updateconstQString&bool -->
<h3 class="fn"><a name="update-2"></a><span class="type">int</span> Q3SqlCursor::<span class="name">update</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>filter</i>, <span class="type">bool</span> <i>invalidate</i> = true )<tt> [virtual protected]</tt></h3>
<p>This is an overloaded function.</p>
<p>Updates the database with the current contents of the cursor edit buffer using the specified <i>filter</i>. Returns the number of records which were updated. For error information, use <a href="qsqlquery.html#lastError">lastError</a>().</p>
<p>Only records which meet the filter criteria are updated, otherwise all records in the table are updated.</p>
<p>If <i>invalidate</i> is true (the default), the cursor can no longer be navigated. A new <a href="q3sqlcursor.html#select">select</a>() call must be made before you can move to a valid record.</p>
<p><b>See also </b><a href="q3sqlcursor.html#primeUpdate">primeUpdate</a>(), <a href="q3sqlcursor.html#setMode">setMode</a>(), and <a href="qsqlquery.html#lastError">lastError</a>().</p>
<!-- @@@update -->
<!-- $$$value[overload1]$$$valueint -->
<h3 class="fn"><a name="value"></a><span class="type"><a href="qvariant.html">QVariant</a></span> Q3SqlCursor::<span class="name">value</span> ( <span class="type">int</span> <i>i</i> ) const</h3>
<p>Returns the value of field number <i>i</i>.</p>
<p><b>See also </b><a href="q3sqlcursor.html#setValue">setValue</a>().</p>
<!-- @@@value -->
<!-- $$$value$$$valueconstQString& -->
<h3 class="fn"><a name="value-2"></a><span class="type"><a href="qvariant.html">QVariant</a></span> Q3SqlCursor::<span class="name">value</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>name</i> ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns the value of the field named <i>name</i>.</p>
<!-- @@@value -->
<!-- $$$operator=[overload1]$$$operator=constQ3SqlCursor& -->
<h3 class="fn"><a name="operator-eq"></a><span class="type">Q3SqlCursor</span> &amp; Q3SqlCursor::<span class="name">operator=</span> ( const <span class="type">Q3SqlCursor</span> &amp; <i>other</i> )</h3>
<p>Sets the cursor equal to <i>other</i>.</p>
<!-- @@@operator= -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2013 Digia Plc and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Digia, Qt and their respective logos are trademarks of Digia Plc 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>