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 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577
|
<?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" />
<!-- qsqldatabase.cpp -->
<title>Qt 4.8: QSqlDatabase Class Reference</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<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="qtsql.html">QtSql</a></li>
<li>QSqlDatabase</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-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</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">QSqlDatabase Class Reference</h1>
<!-- $$$QSqlDatabase-brief -->
<p>The QSqlDatabase class represents a connection to a database. <a href="#details">More...</a></p>
<!-- @@@QSqlDatabase -->
<pre class="cpp"> <span class="preprocessor">#include <QSqlDatabase></span></pre><ul>
<li><a href="qsqldatabase-members.html">List of all members, including inherited members</a></li>
<li><a href="qsqldatabase-qt3.html">Qt 3 support members</a></li>
</ul>
<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="qsqldatabase.html#QSqlDatabase">QSqlDatabase</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#QSqlDatabase-2">QSqlDatabase</a></b> ( const QSqlDatabase & <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#dtor.QSqlDatabase">~QSqlDatabase</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#close">close</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#commit">commit</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#connectOptions">connectOptions</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#connectionName">connectionName</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#databaseName">databaseName</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSqlDriver * </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#driver">driver</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#driverName">driverName</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSqlQuery </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#exec">exec</a></b> ( const QString & <i>query</i> = QString() ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#hostName">hostName</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#isOpen">isOpen</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#isOpenError">isOpenError</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#isValid">isValid</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSqlError </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#lastError">lastError</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSql::NumericalPrecisionPolicy </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#numericalPrecisionPolicy">numericalPrecisionPolicy</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#open">open</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#open-2">open</a></b> ( const QString & <i>user</i>, const QString & <i>password</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#password">password</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#port">port</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSqlIndex </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#primaryIndex">primaryIndex</a></b> ( const QString & <i>tablename</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSqlRecord </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#record">record</a></b> ( const QString & <i>tablename</i> ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#rollback">rollback</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#setConnectOptions">setConnectOptions</a></b> ( const QString & <i>options</i> = QString() )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#setDatabaseName">setDatabaseName</a></b> ( const QString & <i>name</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#setHostName">setHostName</a></b> ( const QString & <i>host</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#setNumericalPrecisionPolicy">setNumericalPrecisionPolicy</a></b> ( QSql::NumericalPrecisionPolicy <i>precisionPolicy</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#setPassword">setPassword</a></b> ( const QString & <i>password</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#setPort">setPort</a></b> ( int <i>port</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#setUserName">setUserName</a></b> ( const QString & <i>name</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#tables">tables</a></b> ( QSql::TableType <i>type</i> = QSql::Tables ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#transaction">transaction</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#userName">userName</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSqlDatabase & </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#operator-eq">operator=</a></b> ( const QSqlDatabase & <i>other</i> )</td></tr>
</table>
<a name="static-public-members"></a>
<h2>Static Public Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QSqlDatabase </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#addDatabase">addDatabase</a></b> ( const QString & <i>type</i>, const QString & <i>connectionName</i> = QLatin1String( defaultConnection ) )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSqlDatabase </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#addDatabase-2">addDatabase</a></b> ( QSqlDriver * <i>driver</i>, const QString & <i>connectionName</i> = QLatin1String( defaultConnection ) )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSqlDatabase </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#cloneDatabase">cloneDatabase</a></b> ( const QSqlDatabase & <i>other</i>, const QString & <i>connectionName</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#connectionNames">connectionNames</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#contains">contains</a></b> ( const QString & <i>connectionName</i> = QLatin1String( defaultConnection ) )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSqlDatabase </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#database">database</a></b> ( const QString & <i>connectionName</i> = QLatin1String( defaultConnection ), bool <i>open</i> = true )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#drivers">drivers</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#isDriverAvailable">isDriverAvailable</a></b> ( const QString & <i>name</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#registerSqlDriver">registerSqlDriver</a></b> ( const QString & <i>name</i>, QSqlDriverCreatorBase * <i>creator</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#removeDatabase">removeDatabase</a></b> ( const QString & <i>connectionName</i> )</td></tr>
</table>
<a name="protected-functions"></a>
<h2>Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#QSqlDatabase-3">QSqlDatabase</a></b> ( const QString & <i>type</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qsqldatabase.html#QSqlDatabase-4">QSqlDatabase</a></b> ( QSqlDriver * <i>driver</i> )</td></tr>
</table>
<a name="details"></a>
<!-- $$$QSqlDatabase-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QSqlDatabase class represents a connection to a database.</p>
<p>The QSqlDatabase class provides an interface for accessing a database through a connection. An instance of QSqlDatabase represents the connection. The connection provides access to the database via one of the <a href="sql-driver.html#supported-databases">supported database drivers</a>, which are derived from <a href="qsqldriver.html">QSqlDriver</a>. Alternatively, you can subclass your own database driver from <a href="qsqldriver.html">QSqlDriver</a>. See <a href="sql-driver.html#how-to-write-your-own-database-driver">How to Write Your Own Database Driver</a> for more information.</p>
<p>Create a connection (i.e., an instance of QSqlDatabase) by calling one of the static <a href="qsqldatabase.html#addDatabase">addDatabase</a>() functions, where you specify <a href="sql-driver.html#supported-databases">the driver or type of driver</a> to use (i.e., what kind of database will you access?) and a connection name. A connection is known by its own name, <i>not</i> by the name of the database it connects to. You can have multiple connections to one database. QSqlDatabase also supports the concept of a <i>default</i> connection, which is the unnamed connection. To create the default connection, don't pass the connection name argument when you call <a href="qsqldatabase.html#addDatabase">addDatabase</a>(). Subsequently, when you call any static member function that takes the connection name argument, if you don't pass the connection name argument, the default connection is assumed. The following snippet shows how to create and open a default connection to a PostgreSQL database:</p>
<pre class="cpp"> <span class="type">QSqlDatabase</span> db <span class="operator">=</span> <span class="type">QSqlDatabase</span><span class="operator">::</span>addDatabase(<span class="string">"QPSQL"</span>);
db<span class="operator">.</span>setHostName(<span class="string">"acidalia"</span>);
db<span class="operator">.</span>setDatabaseName(<span class="string">"customdb"</span>);
db<span class="operator">.</span>setUserName(<span class="string">"mojito"</span>);
db<span class="operator">.</span>setPassword(<span class="string">"J0a1m8"</span>);
<span class="type">bool</span> ok <span class="operator">=</span> db<span class="operator">.</span>open();</pre>
<p>Once the QSqlDatabase object has been created, set the connection parameters with <a href="qsqldatabase.html#setDatabaseName">setDatabaseName</a>(), <a href="qsqldatabase.html#setUserName">setUserName</a>(), <a href="qsqldatabase.html#setPassword">setPassword</a>(), <a href="qsqldatabase.html#setHostName">setHostName</a>(), <a href="qsqldatabase.html#setPort">setPort</a>(), and <a href="qsqldatabase.html#setConnectOptions">setConnectOptions</a>(). Then call <a href="qsqldatabase.html#open">open</a>() to activate the physical connection to the database. The connection is not usable until you open it.</p>
<p>The connection defined above will be the <i>default</i> connection, because we didn't give a connection name to <a href="qsqldatabase.html#addDatabase">addDatabase()</a>. Subsequently, you can get the default connection by calling <a href="qsqldatabase.html#database">database</a>() without the connection name argument:</p>
<pre class="cpp"> <span class="type">QSqlDatabase</span> db <span class="operator">=</span> <span class="type">QSqlDatabase</span><span class="operator">::</span>database();</pre>
<p>QSqlDatabase is a value class. Changes made to a database connection via one instance of QSqlDatabase will affect other instances of QSqlDatabase that represent the same connection. Use <a href="qsqldatabase.html#cloneDatabase">cloneDatabase</a>() to create an independent database connection based on an existing one.</p>
<p>If you create multiple database connections, specify a unique connection name for each one, when you call <a href="qsqldatabase.html#addDatabase">addDatabase</a>(). Use <a href="qsqldatabase.html#database">database</a>() with a connection name to get that connection. Use <a href="qsqldatabase.html#removeDatabase">removeDatabase</a>() with a connection name to remove a connection. QSqlDatabase outputs a warning if you try to remove a connection referenced by other QSqlDatabase objects. Use <a href="qsqldatabase.html#contains">contains</a>() to see if a given connection name is in the list of connections.</p>
<p>Once a connection is established, you can call <a href="qsqldatabase.html#tables">tables</a>() to get the list of tables in the database, call <a href="qsqldatabase.html#primaryIndex">primaryIndex</a>() to get a table's primary index, and call <a href="qsqldatabase.html#record">record</a>() to get meta-information about a table's fields (e.g., field names).</p>
<p><b>Note:</b> <a href="qsqldatabase.html#exec">QSqlDatabase::exec</a>() is deprecated. Use <a href="qsqlquery.html#exec">QSqlQuery::exec</a>() instead.</p>
<p>If the driver supports transactions, use <a href="qsqldatabase.html#transaction">transaction</a>() to start a transaction, and <a href="qsqldatabase.html#commit">commit</a>() or <a href="qsqldatabase.html#rollback">rollback</a>() to complete it. Use <a href="qsqldriver.html#hasFeature">hasFeature()</a> to ask if the driver supports transactions. <b>Note:</b> When using transactions, you must start the transaction before you create your query.</p>
<p>If an error occurrs, <a href="qsqldatabase.html#lastError">lastError</a>() will return information about it.</p>
<p>Get the names of the available SQL drivers with <a href="qsqldatabase.html#drivers">drivers</a>(). Check for the presence of a particular driver with <a href="qsqldatabase.html#isDriverAvailable">isDriverAvailable</a>(). If you have created your own custom driver, you must register it with <a href="qsqldatabase.html#registerSqlDriver">registerSqlDriver</a>().</p>
</div>
<p><b>See also </b><a href="qsqldriver.html">QSqlDriver</a>, <a href="qsqlquery.html">QSqlQuery</a>, <a href="qtsql.html">QtSql Module</a>, and <a href="threads-modules.html#threads-and-the-sql-module">Threads and the SQL Module</a>.</p>
<!-- @@@QSqlDatabase -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QSqlDatabase[overload1]$$$QSqlDatabase -->
<h3 class="fn"><a name="QSqlDatabase"></a>QSqlDatabase::<span class="name">QSqlDatabase</span> ()</h3>
<p>Creates an empty, invalid <a href="qsqldatabase.html">QSqlDatabase</a> object. Use <a href="qsqldatabase.html#addDatabase">addDatabase</a>(), <a href="qsqldatabase.html#removeDatabase">removeDatabase</a>(), and <a href="qsqldatabase.html#database">database</a>() to get valid <a href="qsqldatabase.html">QSqlDatabase</a> objects.</p>
<!-- @@@QSqlDatabase -->
<!-- $$$QSqlDatabase$$$QSqlDatabaseconstQSqlDatabase& -->
<h3 class="fn"><a name="QSqlDatabase-2"></a>QSqlDatabase::<span class="name">QSqlDatabase</span> ( const <span class="type">QSqlDatabase</span> & <i>other</i> )</h3>
<p>Creates a copy of <i>other</i>.</p>
<!-- @@@QSqlDatabase -->
<!-- $$$QSqlDatabase$$$QSqlDatabaseconstQString& -->
<h3 class="fn"><a name="QSqlDatabase-3"></a>QSqlDatabase::<span class="name">QSqlDatabase</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>type</i> )<tt> [protected]</tt></h3>
<p>This is an overloaded function.</p>
<p>Creates a <a href="qsqldatabase.html">QSqlDatabase</a> connection that uses the driver referred to by <i>type</i>. If the <i>type</i> is not recognized, the database connection will have no functionality.</p>
<p>The currently available driver types are:</p>
<table class="generic">
<thead><tr class="qt-style"><th >Driver Type</th><th >Description</th></tr></thead>
<tr valign="top" class="odd"><td >QDB2</td><td >IBM DB2</td></tr>
<tr valign="top" class="even"><td >QIBASE</td><td >Borland InterBase Driver</td></tr>
<tr valign="top" class="odd"><td >QMYSQL</td><td >MySQL Driver</td></tr>
<tr valign="top" class="even"><td >QOCI</td><td >Oracle Call Interface Driver</td></tr>
<tr valign="top" class="odd"><td >QODBC</td><td >ODBC Driver (includes Microsoft SQL Server)</td></tr>
<tr valign="top" class="even"><td >QPSQL</td><td >PostgreSQL Driver</td></tr>
<tr valign="top" class="odd"><td >QSQLITE</td><td >SQLite version 3 or above</td></tr>
<tr valign="top" class="even"><td >QSQLITE2</td><td >SQLite version 2</td></tr>
<tr valign="top" class="odd"><td >QTDS</td><td >Sybase Adaptive Server</td></tr>
</table>
<p>Additional third party drivers, including your own custom drivers, can be loaded dynamically.</p>
<p><b>See also </b><a href="sql-driver.html">SQL Database Drivers</a>, <a href="qsqldatabase.html#registerSqlDriver">registerSqlDriver</a>(), and <a href="qsqldatabase.html#drivers">drivers</a>().</p>
<!-- @@@QSqlDatabase -->
<!-- $$$QSqlDatabase$$$QSqlDatabaseQSqlDriver* -->
<h3 class="fn"><a name="QSqlDatabase-4"></a>QSqlDatabase::<span class="name">QSqlDatabase</span> ( <span class="type"><a href="qsqldriver.html">QSqlDriver</a></span> * <i>driver</i> )<tt> [protected]</tt></h3>
<p>This is an overloaded function.</p>
<p>Creates a database connection using the given <i>driver</i>.</p>
<!-- @@@QSqlDatabase -->
<!-- $$$~QSqlDatabase[overload1]$$$~QSqlDatabase -->
<h3 class="fn"><a name="dtor.QSqlDatabase"></a>QSqlDatabase::<span class="name">~QSqlDatabase</span> ()</h3>
<p>Destroys the object and frees any allocated resources.</p>
<p>If this is the last <a href="qsqldatabase.html">QSqlDatabase</a> object that uses a certain database connection, the database connection is automatically closed.</p>
<p><b>See also </b><a href="qsqldatabase.html#close">close</a>().</p>
<!-- @@@~QSqlDatabase -->
<!-- $$$addDatabase[overload1]$$$addDatabaseconstQString&constQString& -->
<h3 class="fn"><a name="addDatabase"></a><span class="type">QSqlDatabase</span> QSqlDatabase::<span class="name">addDatabase</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>type</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>connectionName</i> = QLatin1String( defaultConnection ) )<tt> [static]</tt></h3>
<p>Adds a database to the list of database connections using the driver <i>type</i> and the connection name <i>connectionName</i>. If there already exists a database connection called <i>connectionName</i>, that connection is removed.</p>
<p>The database connection is referred to by <i>connectionName</i>. The newly added database connection is returned.</p>
<p>If <i>type</i> is not available or could not be loaded, <a href="qsqldatabase.html#isValid">isValid</a>() returns false.</p>
<p>If <i>connectionName</i> is not specified, the new connection becomes the default connection for the application, and subsequent calls to <a href="qsqldatabase.html#database">database</a>() without the connection name argument will return the default connection. If a <i>connectionName</i> is provided here, use database(<i>connectionName</i>) to retrieve the connection.</p>
<p><b>Warning:</b> If you add a connection with the same name as an existing connection, the new connection replaces the old one. If you call this function more than once without specifying <i>connectionName</i>, the default connection will be the one replaced.</p>
<p>Before using the connection, it must be initialized. e.g., call some or all of <a href="qsqldatabase.html#setDatabaseName">setDatabaseName</a>(), <a href="qsqldatabase.html#setUserName">setUserName</a>(), <a href="qsqldatabase.html#setPassword">setPassword</a>(), <a href="qsqldatabase.html#setHostName">setHostName</a>(), <a href="qsqldatabase.html#setPort">setPort</a>(), and <a href="qsqldatabase.html#setConnectOptions">setConnectOptions</a>(), and, finally, <a href="qsqldatabase.html#open">open</a>().</p>
<p><b>Note:</b> This function is <a href="threads-reentrancy.html#thread-safe">thread-safe</a>.</p>
<p><b>See also </b><a href="qsqldatabase.html#database">database</a>(), <a href="qsqldatabase.html#removeDatabase">removeDatabase</a>(), and <a href="threads-modules.html#threads-and-the-sql-module">Threads and the SQL Module</a>.</p>
<!-- @@@addDatabase -->
<!-- $$$addDatabase$$$addDatabaseQSqlDriver*constQString& -->
<h3 class="fn"><a name="addDatabase-2"></a><span class="type">QSqlDatabase</span> QSqlDatabase::<span class="name">addDatabase</span> ( <span class="type"><a href="qsqldriver.html">QSqlDriver</a></span> * <i>driver</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>connectionName</i> = QLatin1String( defaultConnection ) )<tt> [static]</tt></h3>
<p>This overload is useful when you want to create a database connection with a <a href="qsqldriver.html">driver</a> you instantiated yourself. It might be your own database driver, or you might just need to instantiate one of the Qt drivers yourself. If you do this, it is recommended that you include the driver code in your application. For example, you can create a PostgreSQL connection with your own QPSQL driver like this:</p>
<pre class="cpp"> <span class="preprocessor">#include "qtdir/src/sql/drivers/psql/qsql_psql.cpp"</span>
PGconn <span class="operator">*</span>con <span class="operator">=</span> PQconnectdb(<span class="string">"host=server user=bart password=simpson dbname=springfield"</span>);
<span class="type">QPSQLDriver</span> <span class="operator">*</span>drv <span class="operator">=</span> <span class="keyword">new</span> <span class="type">QPSQLDriver</span>(con);
<span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span> db <span class="operator">=</span> <span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span><span class="operator">::</span><a href="qsqldatabase.html#addDatabase">addDatabase</a>(drv); <span class="comment">// becomes the new default connection</span>
<span class="type"><a href="qsqlquery.html">QSqlQuery</a></span> query;
query<span class="operator">.</span><a href="qsqldatabase.html#exec">exec</a>(<span class="string">"SELECT NAME, ID FROM STAFF"</span>);
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span></pre>
<p>The above code sets up a PostgreSQL connection and instantiates a QPSQLDriver object. Next, <a href="qsqldatabase.html#addDatabase">addDatabase</a>() is called to add the connection to the known connections so that it can be used by the Qt SQL classes. When a driver is instantiated with a connection handle (or set of handles), Qt assumes that you have already opened the database connection.</p>
<p><b>Note:</b> We assume that <tt>qtdir</tt> is the directory where Qt is installed. This will pull in the code that is needed to use the PostgreSQL client library and to instantiate a QPSQLDriver object, assuming that you have the PostgreSQL headers somewhere in your include search path.</p>
<p>Remember that you must link your application against the database client library. Make sure the client library is in your linker's search path, and add lines like these to your <tt>.pro</tt> file:</p>
<pre class="cpp"> unix:LIBS <span class="operator">+</span><span class="operator">=</span> <span class="operator">-</span>lpq
win32:LIBS <span class="operator">+</span><span class="operator">=</span> libpqdll<span class="operator">.</span>lib</pre>
<p>The method described works for all the supplied drivers. The only difference will be in the driver constructor arguments. Here is a table of the drivers included with Qt, their source code files, and their constructor arguments:</p>
<table class="generic">
<thead><tr class="qt-style"><th >Driver</th><th >Class name</th><th >Constructor arguments</th><th >File to include</th></tr></thead>
<tr valign="top" class="odd"><td >QPSQL</td><td >QPSQLDriver</td><td >PGconn *connection</td><td ><tt>qsql_psql.cpp</tt></td></tr>
<tr valign="top" class="even"><td >QMYSQL</td><td >QMYSQLDriver</td><td >MYSQL *connection</td><td ><tt>qsql_mysql.cpp</tt></td></tr>
<tr valign="top" class="odd"><td >QOCI</td><td >QOCIDriver</td><td >OCIEnv *environment, OCISvcCtx *serviceContext</td><td ><tt>qsql_oci.cpp</tt></td></tr>
<tr valign="top" class="even"><td >QODBC</td><td >QODBCDriver</td><td >SQLHANDLE environment, SQLHANDLE connection</td><td ><tt>qsql_odbc.cpp</tt></td></tr>
<tr valign="top" class="odd"><td >QDB2</td><td >QDB2</td><td >SQLHANDLE environment, SQLHANDLE connection</td><td ><tt>qsql_db2.cpp</tt></td></tr>
<tr valign="top" class="even"><td >QTDS</td><td >QTDSDriver</td><td >LOGINREC *loginRecord, DBPROCESS *dbProcess, const <a href="qstring.html">QString</a> &hostName</td><td ><tt>qsql_tds.cpp</tt></td></tr>
<tr valign="top" class="odd"><td >QSQLITE</td><td >QSQLiteDriver</td><td >sqlite *connection</td><td ><tt>qsql_sqlite.cpp</tt></td></tr>
<tr valign="top" class="even"><td >QIBASE</td><td >QIBaseDriver</td><td >isc_db_handle connection</td><td ><tt>qsql_ibase.cpp</tt></td></tr>
</table>
<p>The host name (or service name) is needed when constructing the QTDSDriver for creating new connections for internal queries. This is to prevent blocking when several <a href="qsqlquery.html">QSqlQuery</a> objects are used simultaneously.</p>
<p><b>Warning:</b> Adding a database connection with the same connection name as an existing connection, causes the existing connection to be replaced by the new one.</p>
<p><b>Warning:</b> The SQL framework takes ownership of the <i>driver</i>. It must not be deleted. To remove the connection, use <a href="qsqldatabase.html#removeDatabase">removeDatabase</a>().</p>
<p><b>See also </b><a href="qsqldatabase.html#drivers">drivers</a>().</p>
<!-- @@@addDatabase -->
<!-- $$$cloneDatabase[overload1]$$$cloneDatabaseconstQSqlDatabase&constQString& -->
<h3 class="fn"><a name="cloneDatabase"></a><span class="type">QSqlDatabase</span> QSqlDatabase::<span class="name">cloneDatabase</span> ( const <span class="type">QSqlDatabase</span> & <i>other</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>connectionName</i> )<tt> [static]</tt></h3>
<p>Clones the database connection <i>other</i> and and stores it as <i>connectionName</i>. All the settings from the original database, e.g. <a href="qsqldatabase.html#databaseName">databaseName</a>(), <a href="qsqldatabase.html#hostName">hostName</a>(), etc., are copied across. Does nothing if <i>other</i> is an invalid database. Returns the newly created database connection.</p>
<p><b>Note:</b> The new connection has not been opened. Before using the new connection, you must call <a href="qsqldatabase.html#open">open</a>().</p>
<!-- @@@cloneDatabase -->
<!-- $$$close[overload1]$$$close -->
<h3 class="fn"><a name="close"></a><span class="type">void</span> QSqlDatabase::<span class="name">close</span> ()</h3>
<p>Closes the database connection, freeing any resources acquired, and invalidating any existing <a href="qsqlquery.html">QSqlQuery</a> objects that are used with the database.</p>
<p>This will also affect copies of this <a href="qsqldatabase.html">QSqlDatabase</a> object.</p>
<p><b>See also </b><a href="qsqldatabase.html#removeDatabase">removeDatabase</a>().</p>
<!-- @@@close -->
<!-- $$$commit[overload1]$$$commit -->
<h3 class="fn"><a name="commit"></a><span class="type">bool</span> QSqlDatabase::<span class="name">commit</span> ()</h3>
<p>Commits a transaction to the database if the driver supports transactions and a <a href="qsqldatabase.html#transaction">transaction</a>() has been started. Returns <tt>true</tt> if the operation succeeded. Otherwise it returns <tt>false</tt>.</p>
<p><b>Note:</b> For some databases, the commit will fail and return <tt>false</tt> if there is an <a href="qsqlquery.html#isActive">active query</a> using the database for a <tt>SELECT</tt>. Make the query <a href="qsqlquery.html#isActive">inactive</a> before doing the commit.</p>
<p>Call <a href="qsqldatabase.html#lastError">lastError</a>() to get information about errors.</p>
<p><b>See also </b><a href="qsqlquery.html#isActive">QSqlQuery::isActive</a>(), <a href="qsqldriver.html#hasFeature">QSqlDriver::hasFeature</a>(), and <a href="qsqldatabase.html#rollback">rollback</a>().</p>
<!-- @@@commit -->
<!-- $$$connectOptions[overload1]$$$connectOptions -->
<h3 class="fn"><a name="connectOptions"></a><span class="type"><a href="qstring.html">QString</a></span> QSqlDatabase::<span class="name">connectOptions</span> () const</h3>
<p>Returns the connection options string used for this connection. The string may be empty.</p>
<p><b>See also </b><a href="qsqldatabase.html#setConnectOptions">setConnectOptions</a>().</p>
<!-- @@@connectOptions -->
<!-- $$$connectionName[overload1]$$$connectionName -->
<h3 class="fn"><a name="connectionName"></a><span class="type"><a href="qstring.html">QString</a></span> QSqlDatabase::<span class="name">connectionName</span> () const</h3>
<p>Returns the connection name, which may be empty. <b>Note:</b> The connection name is not the <a href="qsqldatabase.html#databaseName">database name</a>.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also </b><a href="qsqldatabase.html#addDatabase">addDatabase</a>().</p>
<!-- @@@connectionName -->
<!-- $$$connectionNames[overload1]$$$connectionNames -->
<h3 class="fn"><a name="connectionNames"></a><span class="type"><a href="qstringlist.html">QStringList</a></span> QSqlDatabase::<span class="name">connectionNames</span> ()<tt> [static]</tt></h3>
<p>Returns a list containing the names of all connections.</p>
<p><b>Note:</b> This function is <a href="threads-reentrancy.html#thread-safe">thread-safe</a>.</p>
<p><b>See also </b><a href="qsqldatabase.html#contains">contains</a>(), <a href="qsqldatabase.html#database">database</a>(), and <a href="threads-modules.html#threads-and-the-sql-module">Threads and the SQL Module</a>.</p>
<!-- @@@connectionNames -->
<!-- $$$contains[overload1]$$$containsconstQString& -->
<h3 class="fn"><a name="contains"></a><span class="type">bool</span> QSqlDatabase::<span class="name">contains</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>connectionName</i> = QLatin1String( defaultConnection ) )<tt> [static]</tt></h3>
<p>Returns true if the list of database connections contains <i>connectionName</i>; otherwise returns false.</p>
<p><b>Note:</b> This function is <a href="threads-reentrancy.html#thread-safe">thread-safe</a>.</p>
<p><b>See also </b><a href="qsqldatabase.html#connectionNames">connectionNames</a>(), <a href="qsqldatabase.html#database">database</a>(), and <a href="threads-modules.html#threads-and-the-sql-module">Threads and the SQL Module</a>.</p>
<!-- @@@contains -->
<!-- $$$database[overload1]$$$databaseconstQString&bool -->
<h3 class="fn"><a name="database"></a><span class="type">QSqlDatabase</span> QSqlDatabase::<span class="name">database</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>connectionName</i> = QLatin1String( defaultConnection ), <span class="type">bool</span> <i>open</i> = true )<tt> [static]</tt></h3>
<p>Returns the database connection called <i>connectionName</i>. The database connection must have been previously added with <a href="qsqldatabase.html#addDatabase">addDatabase</a>(). If <i>open</i> is true (the default) and the database connection is not already open it is opened now. If no <i>connectionName</i> is specified the default connection is used. If <i>connectionName</i> does not exist in the list of databases, an invalid connection is returned.</p>
<p><b>Note:</b> This function is <a href="threads-reentrancy.html#thread-safe">thread-safe</a>.</p>
<p><b>See also </b><a href="qsqldatabase.html#isOpen">isOpen</a>() and <a href="threads-modules.html#threads-and-the-sql-module">Threads and the SQL Module</a>.</p>
<!-- @@@database -->
<!-- $$$databaseName[overload1]$$$databaseName -->
<h3 class="fn"><a name="databaseName"></a><span class="type"><a href="qstring.html">QString</a></span> QSqlDatabase::<span class="name">databaseName</span> () const</h3>
<p>Returns the connection's database name, which may be empty. <b>Note:</b> The database name is not the connection name.</p>
<p><b>See also </b><a href="qsqldatabase.html#setDatabaseName">setDatabaseName</a>().</p>
<!-- @@@databaseName -->
<!-- $$$driver[overload1]$$$driver -->
<h3 class="fn"><a name="driver"></a><span class="type"><a href="qsqldriver.html">QSqlDriver</a></span> * QSqlDatabase::<span class="name">driver</span> () const</h3>
<p>Returns the database driver used to access the database connection.</p>
<p><b>See also </b><a href="qsqldatabase.html#addDatabase">addDatabase</a>() and <a href="qsqldatabase.html#drivers">drivers</a>().</p>
<!-- @@@driver -->
<!-- $$$driverName[overload1]$$$driverName -->
<h3 class="fn"><a name="driverName"></a><span class="type"><a href="qstring.html">QString</a></span> QSqlDatabase::<span class="name">driverName</span> () const</h3>
<p>Returns the connection's driver name.</p>
<p><b>See also </b><a href="qsqldatabase.html#addDatabase">addDatabase</a>() and <a href="qsqldatabase.html#driver">driver</a>().</p>
<!-- @@@driverName -->
<!-- $$$drivers[overload1]$$$drivers -->
<h3 class="fn"><a name="drivers"></a><span class="type"><a href="qstringlist.html">QStringList</a></span> QSqlDatabase::<span class="name">drivers</span> ()<tt> [static]</tt></h3>
<p>Returns a list of all the available database drivers.</p>
<p><b>See also </b><a href="qsqldatabase.html#registerSqlDriver">registerSqlDriver</a>().</p>
<!-- @@@drivers -->
<!-- $$$exec[overload1]$$$execconstQString& -->
<h3 class="fn"><a name="exec"></a><span class="type"><a href="qsqlquery.html">QSqlQuery</a></span> QSqlDatabase::<span class="name">exec</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>query</i> = QString() ) const</h3>
<p>Executes a SQL statement on the database and returns a <a href="qsqlquery.html">QSqlQuery</a> object. Use <a href="qsqldatabase.html#lastError">lastError</a>() to retrieve error information. If <i>query</i> is empty, an empty, invalid query is returned and <a href="qsqldatabase.html#lastError">lastError</a>() is not affected.</p>
<p><b>See also </b><a href="qsqlquery.html">QSqlQuery</a> and <a href="qsqldatabase.html#lastError">lastError</a>().</p>
<!-- @@@exec -->
<!-- $$$hostName[overload1]$$$hostName -->
<h3 class="fn"><a name="hostName"></a><span class="type"><a href="qstring.html">QString</a></span> QSqlDatabase::<span class="name">hostName</span> () const</h3>
<p>Returns the connection's host name; it may be empty.</p>
<p><b>See also </b><a href="qsqldatabase.html#setHostName">setHostName</a>().</p>
<!-- @@@hostName -->
<!-- $$$isDriverAvailable[overload1]$$$isDriverAvailableconstQString& -->
<h3 class="fn"><a name="isDriverAvailable"></a><span class="type">bool</span> QSqlDatabase::<span class="name">isDriverAvailable</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>name</i> )<tt> [static]</tt></h3>
<p>Returns true if a driver called <i>name</i> is available; otherwise returns false.</p>
<p><b>See also </b><a href="qsqldatabase.html#drivers">drivers</a>().</p>
<!-- @@@isDriverAvailable -->
<!-- $$$isOpen[overload1]$$$isOpen -->
<h3 class="fn"><a name="isOpen"></a><span class="type">bool</span> QSqlDatabase::<span class="name">isOpen</span> () const</h3>
<p>Returns true if the database connection is currently open; otherwise returns false.</p>
<!-- @@@isOpen -->
<!-- $$$isOpenError[overload1]$$$isOpenError -->
<h3 class="fn"><a name="isOpenError"></a><span class="type">bool</span> QSqlDatabase::<span class="name">isOpenError</span> () const</h3>
<p>Returns true if there was an error opening the database connection; otherwise returns false. Error information can be retrieved using the <a href="qsqldatabase.html#lastError">lastError</a>() function.</p>
<!-- @@@isOpenError -->
<!-- $$$isValid[overload1]$$$isValid -->
<h3 class="fn"><a name="isValid"></a><span class="type">bool</span> QSqlDatabase::<span class="name">isValid</span> () const</h3>
<p>Returns true if the <a href="qsqldatabase.html">QSqlDatabase</a> has a valid driver.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span> db;
<a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator"><</span><span class="operator"><</span> db<span class="operator">.</span>isValid(); <span class="comment">// Returns false</span>
db <span class="operator">=</span> <span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span><span class="operator">::</span><a href="qsqldatabase.html#database">database</a>(<span class="string">"sales"</span>);
<a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator"><</span><span class="operator"><</span> db<span class="operator">.</span>isValid(); <span class="comment">// Returns true if "sales" connection exists</span>
<span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span><span class="operator">::</span><a href="qsqldatabase.html#removeDatabase">removeDatabase</a>(<span class="string">"sales"</span>);
<a href="qtglobal.html#qDebug">qDebug</a>() <span class="operator"><</span><span class="operator"><</span> db<span class="operator">.</span>isValid(); <span class="comment">// Returns false</span></pre>
<!-- @@@isValid -->
<!-- $$$lastError[overload1]$$$lastError -->
<h3 class="fn"><a name="lastError"></a><span class="type"><a href="qsqlerror.html">QSqlError</a></span> QSqlDatabase::<span class="name">lastError</span> () const</h3>
<p>Returns information about the last error that occurred on the database.</p>
<p>Failures that occur in conjunction with an individual query are reported by <a href="qsqlquery.html#lastError">QSqlQuery::lastError</a>().</p>
<p><b>See also </b><a href="qsqlerror.html">QSqlError</a> and <a href="qsqlquery.html#lastError">QSqlQuery::lastError</a>().</p>
<!-- @@@lastError -->
<!-- $$$numericalPrecisionPolicy[overload1]$$$numericalPrecisionPolicy -->
<h3 class="fn"><a name="numericalPrecisionPolicy"></a><span class="type"><a href="qsql.html#NumericalPrecisionPolicy-enum">QSql::NumericalPrecisionPolicy</a></span> QSqlDatabase::<span class="name">numericalPrecisionPolicy</span> () const</h3>
<p>Returns the current default precision policy for the database connection.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also </b><a href="qsql.html#NumericalPrecisionPolicy-enum">QSql::NumericalPrecisionPolicy</a>, <a href="qsqldatabase.html#setNumericalPrecisionPolicy">setNumericalPrecisionPolicy</a>(), <a href="qsqlquery.html#numericalPrecisionPolicy">QSqlQuery::numericalPrecisionPolicy</a>(), and <a href="qsqlquery.html#setNumericalPrecisionPolicy">QSqlQuery::setNumericalPrecisionPolicy</a>().</p>
<!-- @@@numericalPrecisionPolicy -->
<!-- $$$open[overload1]$$$open -->
<h3 class="fn"><a name="open"></a><span class="type">bool</span> QSqlDatabase::<span class="name">open</span> ()</h3>
<p>Opens the database connection using the current connection values. Returns true on success; otherwise returns false. Error information can be retrieved using <a href="qsqldatabase.html#lastError">lastError</a>().</p>
<p><b>See also </b><a href="qsqldatabase.html#lastError">lastError</a>(), <a href="qsqldatabase.html#setDatabaseName">setDatabaseName</a>(), <a href="qsqldatabase.html#setUserName">setUserName</a>(), <a href="qsqldatabase.html#setPassword">setPassword</a>(), <a href="qsqldatabase.html#setHostName">setHostName</a>(), <a href="qsqldatabase.html#setPort">setPort</a>(), and <a href="qsqldatabase.html#setConnectOptions">setConnectOptions</a>().</p>
<!-- @@@open -->
<!-- $$$open$$$openconstQString&constQString& -->
<h3 class="fn"><a name="open-2"></a><span class="type">bool</span> QSqlDatabase::<span class="name">open</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>user</i>, const <span class="type"><a href="qstring.html">QString</a></span> & <i>password</i> )</h3>
<p>This is an overloaded function.</p>
<p>Opens the database connection using the given <i>user</i> name and <i>password</i>. Returns true on success; otherwise returns false. Error information can be retrieved using the <a href="qsqldatabase.html#lastError">lastError</a>() function.</p>
<p>This function does not store the password it is given. Instead, the password is passed directly to the driver for opening the connection and it is then discarded.</p>
<p><b>See also </b><a href="qsqldatabase.html#lastError">lastError</a>().</p>
<!-- @@@open -->
<!-- $$$password[overload1]$$$password -->
<h3 class="fn"><a name="password"></a><span class="type"><a href="qstring.html">QString</a></span> QSqlDatabase::<span class="name">password</span> () const</h3>
<p>Returns the connection's password. If the password was not set with <a href="qsqldatabase.html#setPassword">setPassword</a>(), and if the password was given in the <a href="qsqldatabase.html#open">open</a>() call, or if no password was used, an empty string is returned.</p>
<p><b>See also </b><a href="qsqldatabase.html#setPassword">setPassword</a>().</p>
<!-- @@@password -->
<!-- $$$port[overload1]$$$port -->
<h3 class="fn"><a name="port"></a><span class="type">int</span> QSqlDatabase::<span class="name">port</span> () const</h3>
<p>Returns the connection's port number. The value is undefined if the port number has not been set.</p>
<p><b>See also </b><a href="qsqldatabase.html#setPort">setPort</a>().</p>
<!-- @@@port -->
<!-- $$$primaryIndex[overload1]$$$primaryIndexconstQString& -->
<h3 class="fn"><a name="primaryIndex"></a><span class="type"><a href="qsqlindex.html">QSqlIndex</a></span> QSqlDatabase::<span class="name">primaryIndex</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>tablename</i> ) const</h3>
<p>Returns the primary index for table <i>tablename</i>. If no primary index exists an empty <a href="qsqlindex.html">QSqlIndex</a> is returned.</p>
<p><b>See also </b><a href="qsqldatabase.html#tables">tables</a>() and <a href="qsqldatabase.html#record">record</a>().</p>
<!-- @@@primaryIndex -->
<!-- $$$record[overload1]$$$recordconstQString& -->
<h3 class="fn"><a name="record"></a><span class="type"><a href="qsqlrecord.html">QSqlRecord</a></span> QSqlDatabase::<span class="name">record</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>tablename</i> ) const</h3>
<p>Returns a <a href="qsqlrecord.html">QSqlRecord</a> populated with the names of all the fields in the table (or view) called <i>tablename</i>. The order in which the fields appear in the record is undefined. If no such table (or view) exists, an empty record is returned.</p>
<!-- @@@record -->
<!-- $$$registerSqlDriver[overload1]$$$registerSqlDriverconstQString&QSqlDriverCreatorBase* -->
<h3 class="fn"><a name="registerSqlDriver"></a><span class="type">void</span> QSqlDatabase::<span class="name">registerSqlDriver</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>name</i>, <span class="type"><a href="qsqldrivercreatorbase.html">QSqlDriverCreatorBase</a></span> * <i>creator</i> )<tt> [static]</tt></h3>
<p>This function registers a new SQL driver called <i>name</i>, within the SQL framework. This is useful if you have a custom SQL driver and don't want to compile it as a plugin.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span><span class="operator">::</span>registerSqlDriver(<span class="string">"MYDRIVER"</span><span class="operator">,</span>
<span class="keyword">new</span> <span class="type"><a href="qsqldrivercreator.html">QSqlDriverCreator</a></span><span class="operator"><</span>MyDatabaseDriver<span class="operator">></span>);
<span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span> db <span class="operator">=</span> <span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span><span class="operator">::</span><a href="qsqldatabase.html#addDatabase">addDatabase</a>(<span class="string">"MYDRIVER"</span>);</pre>
<p><a href="qsqldatabase.html">QSqlDatabase</a> takes ownership of the <i>creator</i> pointer, so you mustn't delete it yourself.</p>
<p><b>See also </b><a href="qsqldatabase.html#drivers">drivers</a>().</p>
<!-- @@@registerSqlDriver -->
<!-- $$$removeDatabase[overload1]$$$removeDatabaseconstQString& -->
<h3 class="fn"><a name="removeDatabase"></a><span class="type">void</span> QSqlDatabase::<span class="name">removeDatabase</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>connectionName</i> )<tt> [static]</tt></h3>
<p>Removes the database connection <i>connectionName</i> from the list of database connections.</p>
<p><b>Warning:</b> There should be no open queries on the database connection when this function is called, otherwise a resource leak will occur.</p>
<p>Example:</p>
<pre class="cpp"> <span class="comment">// WRONG</span>
<span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span> db <span class="operator">=</span> <span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span><span class="operator">::</span><a href="qsqldatabase.html#database">database</a>(<span class="string">"sales"</span>);
<span class="type"><a href="qsqlquery.html">QSqlQuery</a></span> query(<span class="string">"SELECT NAME, DOB FROM EMPLOYEES"</span><span class="operator">,</span> db);
<span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span><span class="operator">::</span>removeDatabase(<span class="string">"sales"</span>); <span class="comment">// will output a warning</span>
<span class="comment">// "db" is now a dangling invalid database connection,</span>
<span class="comment">// "query" contains an invalid result set</span></pre>
<p>The correct way to do it:</p>
<pre class="cpp"> {
<span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span> db <span class="operator">=</span> <span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span><span class="operator">::</span>database(<span class="string">"sales"</span>);
<span class="type"><a href="qsqlquery.html">QSqlQuery</a></span> query(<span class="string">"SELECT NAME, DOB FROM EMPLOYEES"</span><span class="operator">,</span> db);
}
<span class="comment">// Both "db" and "query" are destroyed because they are out of scope</span>
<span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span><span class="operator">::</span>removeDatabase(<span class="string">"sales"</span>); <span class="comment">// correct</span></pre>
<p>To remove the default connection, which may have been created with a call to <a href="qsqldatabase.html#addDatabase">addDatabase</a>() not specifying a connection name, you can retrieve the default connection name by calling <a href="qsqldatabase.html#connectionName">connectionName</a>() on the database returned by <a href="qsqldatabase.html#database">database</a>(). Note that if a default database hasn't been created an invalid database will be returned.</p>
<p><b>Note:</b> This function is <a href="threads-reentrancy.html#thread-safe">thread-safe</a>.</p>
<p><b>See also </b><a href="qsqldatabase.html#database">database</a>(), <a href="qsqldatabase.html#connectionName">connectionName</a>(), and <a href="threads-modules.html#threads-and-the-sql-module">Threads and the SQL Module</a>.</p>
<!-- @@@removeDatabase -->
<!-- $$$rollback[overload1]$$$rollback -->
<h3 class="fn"><a name="rollback"></a><span class="type">bool</span> QSqlDatabase::<span class="name">rollback</span> ()</h3>
<p>Rolls back a transaction on the database, if the driver supports transactions and a <a href="qsqldatabase.html#transaction">transaction</a>() has been started. Returns <tt>true</tt> if the operation succeeded. Otherwise it returns <tt>false</tt>.</p>
<p><b>Note:</b> For some databases, the rollback will fail and return <tt>false</tt> if there is an <a href="qsqlquery.html#isActive">active query</a> using the database for a <tt>SELECT</tt>. Make the query <a href="qsqlquery.html#isActive">inactive</a> before doing the rollback.</p>
<p>Call <a href="qsqldatabase.html#lastError">lastError</a>() to get information about errors.</p>
<p><b>See also </b><a href="qsqlquery.html#isActive">QSqlQuery::isActive</a>(), <a href="qsqldriver.html#hasFeature">QSqlDriver::hasFeature</a>(), and <a href="qsqldatabase.html#commit">commit</a>().</p>
<!-- @@@rollback -->
<!-- $$$setConnectOptions[overload1]$$$setConnectOptionsconstQString& -->
<h3 class="fn"><a name="setConnectOptions"></a><span class="type">void</span> QSqlDatabase::<span class="name">setConnectOptions</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>options</i> = QString() )</h3>
<p>Sets database-specific <i>options</i>. This must be done before the connection is opened or it has no effect (or you can <a href="qsqldatabase.html#close">close</a>() the connection, call this function and <a href="qsqldatabase.html#open">open</a>() the connection again).</p>
<p>The format of the <i>options</i> string is a semicolon separated list of option names or option=value pairs. The options depend on the database client used:</p>
<table class="generic">
<thead><tr class="qt-style"><th >ODBC</th><th >MySQL</th><th >PostgreSQL</th></tr></thead>
<tr valign="top" class="odd"><td ><ul>
<li>SQL_ATTR_ACCESS_MODE</li>
<li>SQL_ATTR_LOGIN_TIMEOUT</li>
<li>SQL_ATTR_CONNECTION_TIMEOUT</li>
<li>SQL_ATTR_CURRENT_CATALOG</li>
<li>SQL_ATTR_METADATA_ID</li>
<li>SQL_ATTR_PACKET_SIZE</li>
<li>SQL_ATTR_TRACEFILE</li>
<li>SQL_ATTR_TRACE</li>
<li>SQL_ATTR_CONNECTION_POOLING</li>
<li>SQL_ATTR_ODBC_VERSION</li>
</ul>
</td><td ><ul>
<li>CLIENT_COMPRESS</li>
<li>CLIENT_FOUND_ROWS</li>
<li>CLIENT_IGNORE_SPACE</li>
<li>CLIENT_SSL</li>
<li>CLIENT_ODBC</li>
<li>CLIENT_NO_SCHEMA</li>
<li>CLIENT_INTERACTIVE</li>
<li>UNIX_SOCKET</li>
<li>MYSQL_OPT_RECONNECT</li>
</ul>
</td><td ><ul>
<li>connect_timeout</li>
<li>options</li>
<li>tty</li>
<li>requiressl</li>
<li>service</li>
</ul>
</td></tr>
<thead><tr class="qt-style"><th >DB2</th><th >OCI</th><th >TDS</th></tr></thead>
<tr valign="top" class="even"><td ><ul>
<li>SQL_ATTR_ACCESS_MODE</li>
<li>SQL_ATTR_LOGIN_TIMEOUT</li>
</ul>
</td><td ><ul>
<li>OCI_ATTR_PREFETCH_ROWS</li>
<li>OCI_ATTR_PREFETCH_MEMORY</li>
</ul>
</td><td ><i>none</i></td></tr>
<thead><tr class="qt-style"><th >SQLite</th><th >Interbase</th></tr></thead>
<tr valign="top" class="odd"><td ><ul>
<li>QSQLITE_BUSY_TIMEOUT</li>
<li>QSQLITE_OPEN_READONLY</li>
<li>QSQLITE_ENABLE_SHARED_CACHE</li>
</ul>
</td><td ><ul>
<li>ISC_DPB_LC_CTYPE</li>
<li>ISC_DPB_SQL_ROLE_NAME</li>
</ul>
</td></tr>
</table>
<p>Examples:</p>
<pre class="cpp"> <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
<span class="comment">// MySQL connection</span>
db<span class="operator">.</span>setConnectOptions(<span class="string">"CLIENT_SSL=1;CLIENT_IGNORE_SPACE=1"</span>); <span class="comment">// use an SSL connection to the server</span>
<span class="keyword">if</span> (<span class="operator">!</span>db<span class="operator">.</span>open()) {
db<span class="operator">.</span>setConnectOptions(); <span class="comment">// clears the connect option string</span>
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
}
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
<span class="comment">// PostgreSQL connection</span>
db<span class="operator">.</span>setConnectOptions(<span class="string">"requiressl=1"</span>); <span class="comment">// enable PostgreSQL SSL connections</span>
<span class="keyword">if</span> (<span class="operator">!</span>db<span class="operator">.</span>open()) {
db<span class="operator">.</span>setConnectOptions(); <span class="comment">// clear options</span>
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
}
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
<span class="comment">// ODBC connection</span>
db<span class="operator">.</span>setConnectOptions(<span class="string">"SQL_ATTR_ACCESS_MODE=SQL_MODE_READ_ONLY;SQL_ATTR_TRACE=SQL_OPT_TRACE_ON"</span>); <span class="comment">// set ODBC options</span>
<span class="keyword">if</span> (<span class="operator">!</span>db<span class="operator">.</span>open()) {
db<span class="operator">.</span>setConnectOptions(); <span class="comment">// don't try to set this option</span>
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
}</pre>
<p>Refer to the client library documentation for more information about the different options.</p>
<p><b>See also </b><a href="qsqldatabase.html#connectOptions">connectOptions</a>().</p>
<!-- @@@setConnectOptions -->
<!-- $$$setDatabaseName[overload1]$$$setDatabaseNameconstQString& -->
<h3 class="fn"><a name="setDatabaseName"></a><span class="type">void</span> QSqlDatabase::<span class="name">setDatabaseName</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>name</i> )</h3>
<p>Sets the connection's database name to <i>name</i>. To have effect, the database name must be set <i>before</i> the connection is <a href="qsqldatabase.html#open">opened</a>. Alternatively, you can <a href="qsqldatabase.html#close">close</a>() the connection, set the database name, and call <a href="qsqldatabase.html#open">open</a>() again. <b>Note:</b> The <i>database name</i> is not the <i>connection name</i>. The connection name must be passed to <a href="qsqldatabase.html#addDatabase">addDatabase</a>() at connection object create time.</p>
<p>For the QOCI (Oracle) driver, the database name is the TNS Service Name.</p>
<p>For the QODBC driver, the <i>name</i> can either be a DSN, a DSN filename (in which case the file must have a <tt>.dsn</tt> extension), or a connection string.</p>
<p>For example, Microsoft Access users can use the following connection string to open an <tt>.mdb</tt> file directly, instead of having to create a DSN entry in the ODBC manager:</p>
<pre class="cpp"> <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
db <span class="operator">=</span> <span class="type"><a href="qsqldatabase.html">QSqlDatabase</a></span><span class="operator">::</span><a href="qsqldatabase.html#addDatabase">addDatabase</a>(<span class="string">"QODBC"</span>);
db<span class="operator">.</span>setDatabaseName(<span class="string">"DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=myaccessfile.mdb"</span>);
<span class="keyword">if</span> (db<span class="operator">.</span>open()) {
<span class="comment">// success!</span>
}
<span class="operator">.</span><span class="operator">.</span><span class="operator">.</span></pre>
<p>There is no default value.</p>
<p><b>See also </b><a href="qsqldatabase.html#databaseName">databaseName</a>(), <a href="qsqldatabase.html#setUserName">setUserName</a>(), <a href="qsqldatabase.html#setPassword">setPassword</a>(), <a href="qsqldatabase.html#setHostName">setHostName</a>(), <a href="qsqldatabase.html#setPort">setPort</a>(), <a href="qsqldatabase.html#setConnectOptions">setConnectOptions</a>(), and <a href="qsqldatabase.html#open">open</a>().</p>
<!-- @@@setDatabaseName -->
<!-- $$$setHostName[overload1]$$$setHostNameconstQString& -->
<h3 class="fn"><a name="setHostName"></a><span class="type">void</span> QSqlDatabase::<span class="name">setHostName</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>host</i> )</h3>
<p>Sets the connection's host name to <i>host</i>. To have effect, the host name must be set <i>before</i> the connection is <a href="qsqldatabase.html#open">opened</a>. Alternatively, you can <a href="qsqldatabase.html#close">close</a>() the connection, set the host name, and call <a href="qsqldatabase.html#open">open</a>() again.</p>
<p>There is no default value.</p>
<p><b>See also </b><a href="qsqldatabase.html#hostName">hostName</a>(), <a href="qsqldatabase.html#setUserName">setUserName</a>(), <a href="qsqldatabase.html#setPassword">setPassword</a>(), <a href="qsqldatabase.html#setDatabaseName">setDatabaseName</a>(), <a href="qsqldatabase.html#setPort">setPort</a>(), <a href="qsqldatabase.html#setConnectOptions">setConnectOptions</a>(), and <a href="qsqldatabase.html#open">open</a>().</p>
<!-- @@@setHostName -->
<!-- $$$setNumericalPrecisionPolicy[overload1]$$$setNumericalPrecisionPolicyQSql::NumericalPrecisionPolicy -->
<h3 class="fn"><a name="setNumericalPrecisionPolicy"></a><span class="type">void</span> QSqlDatabase::<span class="name">setNumericalPrecisionPolicy</span> ( <span class="type"><a href="qsql.html#NumericalPrecisionPolicy-enum">QSql::NumericalPrecisionPolicy</a></span> <i>precisionPolicy</i> )</h3>
<p>Sets the default numerical precision policy used by queries created on this database connection to <i>precisionPolicy</i>.</p>
<p>Note: Drivers that don't support fetching numerical values with low precision will ignore the precision policy. You can use <a href="qsqldriver.html#hasFeature">QSqlDriver::hasFeature</a>() to find out whether a driver supports this feature.</p>
<p>Note: Setting the default precision policy to <i>precisionPolicy</i> doesn't affect any currently active queries.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also </b><a href="qsql.html#NumericalPrecisionPolicy-enum">QSql::NumericalPrecisionPolicy</a>, <a href="qsqldatabase.html#numericalPrecisionPolicy">numericalPrecisionPolicy</a>(), <a href="qsqlquery.html#setNumericalPrecisionPolicy">QSqlQuery::setNumericalPrecisionPolicy</a>(), and <a href="qsqlquery.html#numericalPrecisionPolicy">QSqlQuery::numericalPrecisionPolicy</a>().</p>
<!-- @@@setNumericalPrecisionPolicy -->
<!-- $$$setPassword[overload1]$$$setPasswordconstQString& -->
<h3 class="fn"><a name="setPassword"></a><span class="type">void</span> QSqlDatabase::<span class="name">setPassword</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>password</i> )</h3>
<p>Sets the connection's password to <i>password</i>. To have effect, the password must be set <i>before</i> the connection is <a href="qsqldatabase.html#open">opened</a>. Alternatively, you can <a href="qsqldatabase.html#close">close</a>() the connection, set the password, and call <a href="qsqldatabase.html#open">open</a>() again.</p>
<p>There is no default value.</p>
<p><b>Warning:</b> This function stores the password in plain text within Qt. Use the <a href="qsqldatabase.html#open">open</a>() call that takes a password as parameter to avoid this behavior.</p>
<p><b>See also </b><a href="qsqldatabase.html#password">password</a>(), <a href="qsqldatabase.html#setUserName">setUserName</a>(), <a href="qsqldatabase.html#setDatabaseName">setDatabaseName</a>(), <a href="qsqldatabase.html#setHostName">setHostName</a>(), <a href="qsqldatabase.html#setPort">setPort</a>(), <a href="qsqldatabase.html#setConnectOptions">setConnectOptions</a>(), and <a href="qsqldatabase.html#open">open</a>().</p>
<!-- @@@setPassword -->
<!-- $$$setPort[overload1]$$$setPortint -->
<h3 class="fn"><a name="setPort"></a><span class="type">void</span> QSqlDatabase::<span class="name">setPort</span> ( <span class="type">int</span> <i>port</i> )</h3>
<p>Sets the connection's port number to <i>port</i>. To have effect, the port number must be set <i>before</i> the connection is <a href="qsqldatabase.html#open">opened</a>. Alternatively, you can <a href="qsqldatabase.html#close">close</a>() the connection, set the port number, and call <a href="qsqldatabase.html#open">open</a>() again..</p>
<p>There is no default value.</p>
<p><b>See also </b><a href="qsqldatabase.html#port">port</a>(), <a href="qsqldatabase.html#setUserName">setUserName</a>(), <a href="qsqldatabase.html#setPassword">setPassword</a>(), <a href="qsqldatabase.html#setHostName">setHostName</a>(), <a href="qsqldatabase.html#setDatabaseName">setDatabaseName</a>(), <a href="qsqldatabase.html#setConnectOptions">setConnectOptions</a>(), and <a href="qsqldatabase.html#open">open</a>().</p>
<!-- @@@setPort -->
<!-- $$$setUserName[overload1]$$$setUserNameconstQString& -->
<h3 class="fn"><a name="setUserName"></a><span class="type">void</span> QSqlDatabase::<span class="name">setUserName</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>name</i> )</h3>
<p>Sets the connection's user name to <i>name</i>. To have effect, the user name must be set <i>before</i> the connection is <a href="qsqldatabase.html#open">opened</a>. Alternatively, you can <a href="qsqldatabase.html#close">close</a>() the connection, set the user name, and call <a href="qsqldatabase.html#open">open</a>() again.</p>
<p>There is no default value.</p>
<p><b>See also </b><a href="qsqldatabase.html#userName">userName</a>(), <a href="qsqldatabase.html#setDatabaseName">setDatabaseName</a>(), <a href="qsqldatabase.html#setPassword">setPassword</a>(), <a href="qsqldatabase.html#setHostName">setHostName</a>(), <a href="qsqldatabase.html#setPort">setPort</a>(), <a href="qsqldatabase.html#setConnectOptions">setConnectOptions</a>(), and <a href="qsqldatabase.html#open">open</a>().</p>
<!-- @@@setUserName -->
<!-- $$$tables[overload1]$$$tablesQSql::TableType -->
<h3 class="fn"><a name="tables"></a><span class="type"><a href="qstringlist.html">QStringList</a></span> QSqlDatabase::<span class="name">tables</span> ( <span class="type"><a href="qsql.html#TableType-enum">QSql::TableType</a></span> <i>type</i> = QSql::Tables ) const</h3>
<p>Returns a list of the database's tables, system tables and views, as specified by the parameter <i>type</i>.</p>
<p><b>See also </b><a href="qsqldatabase.html#primaryIndex">primaryIndex</a>() and <a href="qsqldatabase.html#record">record</a>().</p>
<!-- @@@tables -->
<!-- $$$transaction[overload1]$$$transaction -->
<h3 class="fn"><a name="transaction"></a><span class="type">bool</span> QSqlDatabase::<span class="name">transaction</span> ()</h3>
<p>Begins a transaction on the database if the driver supports transactions. Returns <tt>true</tt> if the operation succeeded. Otherwise it returns <tt>false</tt>.</p>
<p><b>See also </b><a href="qsqldriver.html#hasFeature">QSqlDriver::hasFeature</a>(), <a href="qsqldatabase.html#commit">commit</a>(), and <a href="qsqldatabase.html#rollback">rollback</a>().</p>
<!-- @@@transaction -->
<!-- $$$userName[overload1]$$$userName -->
<h3 class="fn"><a name="userName"></a><span class="type"><a href="qstring.html">QString</a></span> QSqlDatabase::<span class="name">userName</span> () const</h3>
<p>Returns the connection's user name; it may be empty.</p>
<p><b>See also </b><a href="qsqldatabase.html#setUserName">setUserName</a>().</p>
<!-- @@@userName -->
<!-- $$$operator=[overload1]$$$operator=constQSqlDatabase& -->
<h3 class="fn"><a name="operator-eq"></a><span class="type">QSqlDatabase</span> & QSqlDatabase::<span class="name">operator=</span> ( const <span class="type">QSqlDatabase</span> & <i>other</i> )</h3>
<p>Assigns <i>other</i> to this object.</p>
<!-- @@@operator= -->
</div>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2012 Nokia Corporation 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>
Nokia, Qt and their respective logos are trademarks of Nokia Corporation
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>
</body>
</html>
|