/usr/share/qt3/doc/html/qsqldriver.html is in qt3-doc 3:3.3.8-b-8ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/sql/qsqldriver.cpp:52 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QSqlDriver Class</title>
<style type="text/css"><!--
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 Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped 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 <<a href="qsqldriver-h.html">qsqldriver.h</a>></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 class=fn>enum <a href="#DriverFeature-enum"><b>DriverFeature</b></a> { Transactions, QuerySize, BLOB, Unicode, PreparedQueries, NamedPlaceholders, PositionalPlaceholders }</li>
<li class=fn><a href="#QSqlDriver"><b>QSqlDriver</b></a> ( QObject * parent = 0, const char * name = 0 )</li>
<li class=fn><a href="#~QSqlDriver"><b>~QSqlDriver</b></a> ()</li>
<li class=fn>bool <a href="#isOpen"><b>isOpen</b></a> () const</li>
<li class=fn>bool <a href="#isOpenError"><b>isOpenError</b></a> () const</li>
<li class=fn>virtual bool <a href="#beginTransaction"><b>beginTransaction</b></a> ()</li>
<li class=fn>virtual bool <a href="#commitTransaction"><b>commitTransaction</b></a> ()</li>
<li class=fn>virtual bool <a href="#rollbackTransaction"><b>rollbackTransaction</b></a> ()</li>
<li class=fn>virtual QStringList <a href="#tables"><b>tables</b></a> ( const QString & tableType ) const</li>
<li class=fn>virtual QSqlIndex <a href="#primaryIndex"><b>primaryIndex</b></a> ( const QString & tableName ) const</li>
<li class=fn>virtual QSqlRecord <a href="#record"><b>record</b></a> ( const QString & tableName ) const</li>
<li class=fn>virtual QSqlRecord <a href="#record-2"><b>record</b></a> ( const QSqlQuery & query ) const</li>
<li class=fn>virtual QSqlRecordInfo <a href="#recordInfo"><b>recordInfo</b></a> ( const QString & tablename ) const</li>
<li class=fn>virtual QSqlRecordInfo <a href="#recordInfo-2"><b>recordInfo</b></a> ( const QSqlQuery & query ) const</li>
<li class=fn>virtual QString <a href="#nullText"><b>nullText</b></a> () const</li>
<li class=fn>virtual QString <a href="#formatValue"><b>formatValue</b></a> ( const QSqlField * field, bool trimStrings = FALSE ) const</li>
<li class=fn>QSqlError <a href="#lastError"><b>lastError</b></a> () const</li>
<li class=fn>virtual bool <a href="#hasFeature"><b>hasFeature</b></a> ( DriverFeature f ) const = 0</li>
<li class=fn>virtual bool <a href="#open"><b>open</b></a> ( const QString & db, const QString & user = QString::null, const QString & password = QString::null, const QString & host = QString::null, int port = -1 ) = 0</li>
<li class=fn>virtual void <a href="#close"><b>close</b></a> () = 0</li>
<li class=fn>virtual QSqlQuery <a href="#createQuery"><b>createQuery</b></a> () const = 0</li>
<li class=fn>bool <a href="#open-2"><b>open</b></a> ( const QString & db, const QString & user, const QString & password, const QString & host, int port, const QString & connOpts )</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>virtual void <a href="#setOpen"><b>setOpen</b></a> ( bool o )</li>
<li class=fn>virtual void <a href="#setOpenError"><b>setOpenError</b></a> ( bool e )</li>
<li class=fn>virtual void <a href="#setLastError"><b>setLastError</b></a> ( const QSqlError & e )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
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>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.
<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
<li><tt>QSqlDriver::Unicode</tt> - whether the driver supports Unicode strings if the
database server does
<li><tt>QSqlDriver::PreparedQueries</tt> - whether the driver supports prepared query execution
<li><tt>QSqlDriver::NamedPlaceholders</tt> - whether the driver supports usage of named placeholders
<li><tt>QSqlDriver::PositionalPlaceholders</tt> - whether the driver supports usage of positional placeholders
</ul><p> More information about supported features can be found in the
<a href="sql-driver.html">Qt SQL driver</a> documentation.
<p> <p>See also <a href="#hasFeature">hasFeature</a>().
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QSqlDriver"></a>QSqlDriver::QSqlDriver ( <a href="qobject.html">QObject</a> * parent = 0, const char * name = 0 )
</h3>
Default constructor. Creates a new driver with parent <em>parent</em>,
called <em>name</em>.
<p>
<h3 class=fn><a name="~QSqlDriver"></a>QSqlDriver::~QSqlDriver ()
</h3>
Destroys the object and frees any allocated resources.
<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>().
<h3 class=fn>void <a name="close"></a>QSqlDriver::close ()<tt> [pure virtual]</tt>
</h3>
<p> 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>().
<h3 class=fn><a href="qsqlquery.html">QSqlQuery</a> <a name="createQuery"></a>QSqlDriver::createQuery () const<tt> [pure virtual]</tt>
</h3>
<p> 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 <a href="qsqlfield.html">QSqlField</a> * field, bool 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>
<p> <li> If <em>field</em> is NULL, <a href="#nullText">nullText</a>() is returned.
<p> <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.
<p> <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.
<p> <li> If <em>field</em> is bytearray data, and the driver can edit binary
fields, the value is formatted as a hexadecimal string.
<p> <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> 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>.
<h3 class=fn>bool <a name="isOpen"></a>QSqlDriver::isOpen () const
</h3>
Returns TRUE if the database connection is open; otherwise returns
FALSE.
<h3 class=fn>bool <a name="isOpenError"></a>QSqlDriver::isOpenError () const
</h3>
Returns TRUE if the there was an error opening the database
connection; otherwise returns FALSE.
<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.
<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".
<h3 class=fn>bool <a name="open"></a>QSqlDriver::open ( const <a href="qstring.html">QString</a> & db, const <a href="qstring.html">QString</a> & user = QString::null, const <a href="qstring.html">QString</a> & password = QString::null, const <a href="qstring.html">QString</a> & host = QString::null, int 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>bool <a name="open-2"></a>QSqlDriver::open ( const <a href="qstring.html">QString</a> & db, const <a href="qstring.html">QString</a> & user, const <a href="qstring.html">QString</a> & password, const <a href="qstring.html">QString</a> & host, int port, const <a href="qstring.html">QString</a> & connOpts )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Open a database connection on database <em>db</em>, using user name <em>user</em>, password <em>password</em>, host <em>host</em>, port <em>port</em> and
connection options <em>connOpts</em>.
<p> Returns TRUE on success and FALSE on failure.
<p> <p>See also <a href="#setOpen">setOpen</a>().
<h3 class=fn><a href="qsqlindex.html">QSqlIndex</a> <a name="primaryIndex"></a>QSqlDriver::primaryIndex ( const <a href="qstring.html">QString</a> & 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.
<h3 class=fn><a href="qsqlrecord.html">QSqlRecord</a> <a name="record"></a>QSqlDriver::record ( const <a href="qstring.html">QString</a> & 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 record is
returned. The default implementation returns an empty record.
<h3 class=fn><a href="qsqlrecord.html">QSqlRecord</a> <a name="record-2"></a>QSqlDriver::record ( const <a href="qsqlquery.html">QSqlQuery</a> & 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.
<h3 class=fn><a href="qsqlrecordinfo.html">QSqlRecordInfo</a> <a name="recordInfo"></a>QSqlDriver::recordInfo ( const <a href="qstring.html">QString</a> & tablename ) const<tt> [virtual]</tt>
</h3>
Returns a <a href="qsqlrecordinfo.html">QSqlRecordInfo</a> object with meta data about the table <em>tablename</em>.
<h3 class=fn><a href="qsqlrecordinfo.html">QSqlRecordInfo</a> <a name="recordInfo-2"></a>QSqlDriver::recordInfo ( const <a href="qsqlquery.html">QSqlQuery</a> & 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 less
information than the <a href="#recordInfo">recordInfo</a>() function which takes the name of
a table as parameter.
<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>().
<h3 class=fn>void <a name="setLastError"></a>QSqlDriver::setLastError ( const <a href="qsqlerror.html">QSqlError</a> & 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>().
<h3 class=fn>void <a name="setOpen"></a>QSqlDriver::setOpen ( bool 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>().
<h3 class=fn>void <a name="setOpenError"></a>QSqlDriver::setOpenError ( bool 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>().
<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="tables"></a>QSqlDriver::tables ( const <a href="qstring.html">QString</a> & tableType ) const<tt> [virtual]</tt>
</h3>
Returns a list of tables in the database. The default
implementation returns an empty list.
<p> The <em>tableType</em> argument describes what types of tables
should be returned. Due to binary compatibility, the string
contains the value of the enum QSql::TableTypes as text.
An empty string should be treated as QSql::Tables for
downward compatibility.
<p> <p>See also <a href="qsql.html#TableType-enum">QSql::TableType</a>.
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright © 1995-2007
<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 © 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>
|