Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 1812

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/sql/qsqldriver.cpp:48 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QSqlDriver Class</title>
<style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QSqlDriver Class Reference<br><small>[<a href="sql.html">sql module</a>]</small></h1>

<p>The QSqlDriver class is an abstract base class for accessing
SQL databases.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qsqldriver-h.html">qsqldriver.h</a>&gt;</tt>
<p>Inherits <a href="qobject.html">QObject</a>.
<p><a href="qsqldriver-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div class=fn>enum <a href="#DriverFeature-enum"><b>DriverFeature</b></a> { Transactions, QuerySize, BLOB }</div></li>
<li><div class=fn><a href="#QSqlDriver"><b>QSqlDriver</b></a> ( QObject&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</div></li>
<li><div class=fn><a href="#~QSqlDriver"><b>~QSqlDriver</b></a> ()</div></li>
<li><div class=fn>bool <a href="#isOpen"><b>isOpen</b></a> () const</div></li>
<li><div class=fn>bool <a href="#isOpenError"><b>isOpenError</b></a> () const</div></li>
<li><div class=fn>virtual bool <a href="#beginTransaction"><b>beginTransaction</b></a> ()</div></li>
<li><div class=fn>virtual bool <a href="#commitTransaction"><b>commitTransaction</b></a> ()</div></li>
<li><div class=fn>virtual bool <a href="#rollbackTransaction"><b>rollbackTransaction</b></a> ()</div></li>
<li><div class=fn>virtual QStringList <a href="#tables"><b>tables</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;user ) const</div></li>
<li><div class=fn>virtual QSqlIndex <a href="#primaryIndex"><b>primaryIndex</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;tableName ) const</div></li>
<li><div class=fn>virtual QSqlRecord <a href="#record"><b>record</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;tableName ) const</div></li>
<li><div class=fn>virtual QSqlRecord <a href="#record-2"><b>record</b></a> ( const&nbsp;QSqlQuery&nbsp;&amp;&nbsp;query ) const</div></li>
<li><div class=fn>virtual QSqlRecordInfo <a href="#recordInfo"><b>recordInfo</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;tablename ) const</div></li>
<li><div class=fn>virtual QSqlRecordInfo <a href="#recordInfo-2"><b>recordInfo</b></a> ( const&nbsp;QSqlQuery&nbsp;&amp;&nbsp;query ) const</div></li>
<li><div class=fn>virtual QString <a href="#nullText"><b>nullText</b></a> () const</div></li>
<li><div class=fn>virtual QString <a href="#formatValue"><b>formatValue</b></a> ( const&nbsp;QSqlField&nbsp;*&nbsp;field, bool&nbsp;trimStrings = FALSE ) const</div></li>
<li><div class=fn>QSqlError <a href="#lastError"><b>lastError</b></a> () const</div></li>
<li><div class=fn>virtual bool <a href="#hasFeature"><b>hasFeature</b></a> ( DriverFeature&nbsp;f ) const = 0</div></li>
<li><div class=fn>virtual bool <a href="#open"><b>open</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;db, const&nbsp;QString&nbsp;&amp;&nbsp;user = QString::null, const&nbsp;QString&nbsp;&amp;&nbsp;password = QString::null, const&nbsp;QString&nbsp;&amp;&nbsp;host = QString::null, int&nbsp;port = -1 ) = 0</div></li>
<li><div class=fn>virtual void <a href="#close"><b>close</b></a> () = 0</div></li>
<li><div class=fn>virtual QSqlQuery <a href="#createQuery"><b>createQuery</b></a> () const = 0</div></li>
</ul>
<h2>Protected Members</h2>
<ul>
<li><div class=fn>virtual void <a href="#setOpen"><b>setOpen</b></a> ( bool&nbsp;o )</div></li>
<li><div class=fn>virtual void <a href="#setOpenError"><b>setOpenError</b></a> ( bool&nbsp;e )</div></li>
<li><div class=fn>virtual void <a href="#setLastError"><b>setLastError</b></a> ( const&nbsp;QSqlError&nbsp;&amp;&nbsp;e )</div></li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>



<p> The QSqlDriver class is an abstract base class for accessing
SQL databases.
<p> 
<p> This class should not be used directly.
Use <a href="qsqldatabase.html">QSqlDatabase</a> instead.
<p> <p>See also <a href="database.html">Database Classes</a>.

<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="DriverFeature-enum"></a>QSqlDriver::DriverFeature</h3> 
<p> This enum contains a list of features a driver may support. Use <a href="#hasFeature">hasFeature</a>()
to query whether a feature is supported or not.
<p> The currently defined values are:
<ul>
<li><tt>QSqlDriver::Transactions</tt> - whether the driver supports SQL transactions
<li><tt>QSqlDriver::QuerySize</tt> - whether the database is capable of reporting the size
of a query. Note that some databases do not support returning the size
(i.e. number of rows returned) of a query, in which case <a href="qsqlquery.html#size">QSqlQuery::size</a>() will return -1
<li><tt>QSqlDriver::BLOB</tt> - whether the driver supports Binary Large Object fields
</ul><p> <p>See also <a href="#hasFeature">hasFeature</a>().

<p> 
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QSqlDriver"></a>QSqlDriver::QSqlDriver ( <a href="qobject.html">QObject</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>  Default constructor. Creates a new driver with parent <em>parent</em> and
name <em>name</em>.
<p> 
<h3 class=fn><a name="~QSqlDriver"></a>QSqlDriver::~QSqlDriver ()
</h3> Destroys the object and frees any allocated resources.
<p> 
<h3 class=fn>bool <a name="beginTransaction"></a>QSqlDriver::beginTransaction ()<tt> [virtual]</tt>
</h3> Protected function which derived classes can reimplement to begin a
transaction. If successful, return TRUE, otherwise return FALSE.
The default implementation returns FALSE.
<p> <p>See also <a href="#commitTransaction">commitTransaction</a>() and <a href="#rollbackTransaction">rollbackTransaction</a>().

<p> 
<h3 class=fn>void <a name="close"></a>QSqlDriver::close ()<tt> [pure virtual]</tt>
</h3> 
Derived classes must reimplement this abstract virtual function in
order to close the database connection. Return TRUE on success,
FALSE on failure.
<p> <p>See also <a href="#setOpen">setOpen</a>().

<p> 
<h3 class=fn>bool <a name="commitTransaction"></a>QSqlDriver::commitTransaction ()<tt> [virtual]</tt>
</h3> Protected function which derived classes can reimplement to commit a
transaction. If successful, return TRUE, otherwise return FALSE. The
default implementation returns FALSE.
<p> <p>See also <a href="#beginTransaction">beginTransaction</a>() and <a href="#rollbackTransaction">rollbackTransaction</a>().

<p> 
<h3 class=fn><a href="qsqlquery.html">QSqlQuery</a> <a name="createQuery"></a>QSqlDriver::createQuery () const<tt> [pure virtual]</tt>
</h3> 
Creates an empty SQL result on the database.  Derived classes must
reimplement this function and return a <a href="qsqlquery.html">QSqlQuery</a> object appropriate
for their database to the caller.
<p> 
<h3 class=fn><a href="qstring.html">QString</a> <a name="formatValue"></a>QSqlDriver::formatValue ( const&nbsp;<a href="qsqlfield.html">QSqlField</a>&nbsp;*&nbsp;field, bool&nbsp;trimStrings = FALSE ) const<tt> [virtual]</tt>
</h3>  Returns a string representation of the <em>field</em> value for the
database.  This is used, for example, when constructing INSERT and
UPDATE statements.
<p> The default implementation returns the value formatted as a string
according to the following rules:
<p> <ul>
<li> If <em>field</em> is null, <a href="#nullText">nullText</a>() is returned.
<li> If <em>field</em> is character data, the value is returned enclosed
in single quotation marks, which is appropriate for many SQL
databases. Any embedded single-quote characters are escaped
(replaced with two single-quote characters). If <em>trimStrings</em> is
TRUE (the default is FALSE), all trailing whitespace is trimmed from
the field.
<li> If <em>field</em> is date/time data, the value is formatted in ISO
format and enclosed in single quotation marks.  If the date/time
data is invalid, nullText() is returned.
<li> If <em>field</em> is bytearray data, and the driver can edit binary
fields, the value is formatted as a hexadecimal string.
<li> For any other field type toString() will be called on its value
and the result returned.
<p> </ul>
<p> <p>See also <a href="qvariant.html#toString">QVariant::toString</a>().

<p> 
<h3 class=fn>bool <a name="hasFeature"></a>QSqlDriver::hasFeature ( <a href="qsqldriver.html#DriverFeature-enum">DriverFeature</a>&nbsp;f ) const<tt> [pure virtual]</tt>
</h3> 
<p> Returns TRUE if the driver supports feature <em>f</em>; otherwise returns FALSE.
<p> Note that some databases need to be <a href="#open">open</a>() before this can be
determined.
<p> <p>See also <a href="#DriverFeature-enum">DriverFeature</a>.

<p> 
<h3 class=fn>bool <a name="isOpen"></a>QSqlDriver::isOpen () const
</h3>  Returns TRUE if the database connection is open, FALSE otherwise.
<p> 
<h3 class=fn>bool <a name="isOpenError"></a>QSqlDriver::isOpenError () const
</h3>  Returns TRUE if the there was an error opening the database
connection, FALSE otherwise.
<p> 
<h3 class=fn><a href="qsqlerror.html">QSqlError</a> <a name="lastError"></a>QSqlDriver::lastError () const
</h3> Returns a <a href="qsqlerror.html">QSqlError</a> object which contains information about the last
error that occurred on the database.
<p> 
<h3 class=fn><a href="qstring.html">QString</a> <a name="nullText"></a>QSqlDriver::nullText () const<tt> [virtual]</tt>
</h3>  Returns a string representation of the 'NULL' value for the
database.  This is used, for example, when constructing INSERT and
UPDATE statements.  The default implementation returns the string 'NULL'.
<p> 
<h3 class=fn>bool <a name="open"></a>QSqlDriver::open ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;db, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;user = QString::null, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;password = QString::null, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;host = QString::null, int&nbsp;port = -1 )<tt> [pure virtual]</tt>
</h3> 
<p> Derived classes must reimplement this abstract virtual function in
order to open a database connection on database <em>db</em>, using user
name <em>user</em>, password <em>password</em>, host <em>host</em> and port <em>port</em>.
<p> The function <em>must</em> return TRUE on success and FALSE on failure.
<p> <p>See also <a href="#setOpen">setOpen</a>().

<p> 
<h3 class=fn><a href="qsqlindex.html">QSqlIndex</a> <a name="primaryIndex"></a>QSqlDriver::primaryIndex ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;tableName ) const<tt> [virtual]</tt>
</h3>
Returns the primary index for table <em>tableName</em>.  Returns an empty
<a href="qsqlindex.html">QSqlIndex</a> if the table doesn't have a primary index. The default
implementation returns an empty index.
<p> 
<h3 class=fn><a href="qsqlrecord.html">QSqlRecord</a> <a name="record"></a>QSqlDriver::record ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;tableName ) const<tt> [virtual]</tt>
</h3>
Returns a <a href="qsqlrecord.html">QSqlRecord</a> populated with the names of the fields in table
<em>tableName</em>.	 If no such table exists, an empty list is returned.
The default implementation returns an empty record.
<p> 
<h3 class=fn><a href="qsqlrecord.html">QSqlRecord</a> <a name="record-2"></a>QSqlDriver::record ( const&nbsp;<a href="qsqlquery.html">QSqlQuery</a>&nbsp;&amp;&nbsp;query ) const<tt> [virtual]</tt>
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns a <a href="qsqlrecord.html">QSqlRecord</a> populated with the names of the fields in the
SQL <em>query</em>. The default implementation returns an empty record.
<p> 
<h3 class=fn><a href="qsqlrecordinfo.html">QSqlRecordInfo</a> <a name="recordInfo"></a>QSqlDriver::recordInfo ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;tablename ) const<tt> [virtual]</tt>
</h3> Returns a <a href="qsqlrecordinfo.html">QSqlRecordInfo</a> object with meta data on the table <em>tablename</em>.

<h3 class=fn><a href="qsqlrecordinfo.html">QSqlRecordInfo</a> <a name="recordInfo-2"></a>QSqlDriver::recordInfo ( const&nbsp;<a href="qsqlquery.html">QSqlQuery</a>&nbsp;&amp;&nbsp;query ) const<tt> [virtual]</tt>
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns a <a href="qsqlrecordinfo.html">QSqlRecordInfo</a> object with meta data for the <a href="qsqlquery.html">QSqlQuery</a> <em>query</em>.
Note that this overloaded function may return not as much information as
the recordInfo function which takes the name of a table as parameter.
<p> 
<h3 class=fn>bool <a name="rollbackTransaction"></a>QSqlDriver::rollbackTransaction ()<tt> [virtual]</tt>
</h3> Protected function which derived classes can reimplement to rollback a
transaction. If successful, return TRUE, otherwise return FALSE.
The default implementation returns FALSE.
<p> <p>See also <a href="#beginTransaction">beginTransaction</a>() and <a href="#commitTransaction">commitTransaction</a>().

<p> 
<h3 class=fn>void <a name="setLastError"></a>QSqlDriver::setLastError ( const&nbsp;<a href="qsqlerror.html">QSqlError</a>&nbsp;&amp;&nbsp;e )<tt> [virtual protected]</tt>
</h3> Protected function which allows derived classes to set the value of
the last error, <em>e</em>, that occurred on the database.
<p> <p>See also <a href="#lastError">lastError</a>().

<p> 
<h3 class=fn>void <a name="setOpen"></a>QSqlDriver::setOpen ( bool&nbsp;o )<tt> [virtual protected]</tt>
</h3> Protected function which sets the open state of the database to <em>o</em>.
Derived classes can use this function to report the status of <a href="#open">open</a>().
<p> <p>See also <a href="#open">open</a>() and <a href="#setOpenError">setOpenError</a>().

<p> 
<h3 class=fn>void <a name="setOpenError"></a>QSqlDriver::setOpenError ( bool&nbsp;e )<tt> [virtual protected]</tt>
</h3> Protected function which sets the open error state of the database to <em>e</em>.
Derived classes can use this function to report the status of <a href="#open">open</a>().
Note that if <em>e</em> is TRUE the open state of the database is set to closed
(i.e., <a href="#isOpen">isOpen</a>() returns FALSE).
<p> <p>See also <a href="#open">open</a>().

<p> 
<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="tables"></a>QSqlDriver::tables ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;user ) const<tt> [virtual]</tt>
</h3>
Returns a list of tables in the database.  The default
implementation returns an empty list.
<p> Currently the <em>user</em> argument is unused.

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2001
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2001 
<a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt version 3.0.2</div>
</table></div></address></body>
</html>