1
<?xml version="1.0" encoding="iso-8859-1"?>
3
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/sql/kernel/qsqlerror.cpp -->
7
<title>Qt 4.0: QSqlError Class Reference</title>
8
<style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
9
a:link { color: #004faf; text-decoration: none }
10
a:visited { color: #672967; text-decoration: none }
11
td.postheader { font-family: sans-serif }
12
tr.address { font-family: sans-serif }
13
body { background: #ffffff; color: black; }</style>
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
19
<td width="1"> </td><td class="postheader" 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>
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QSqlError Class Reference</h1>
21
<p>The QSqlError class provides SQL database error information. <a href="#details">More...</a></p>
22
<pre>#include <QSqlError></pre><p>Part of the <a href="qtsql.html">QtSql</a> module.</p>
24
<li><a href="qsqlerror-members.html">List of all members, including inherited members</a></li>
26
<a name="public-types"></a>
29
<li><div class="fn"/>enum <b><a href="qsqlerror.html#ErrorType-enum">ErrorType</a></b> { NoError, ConnectionError, StatementError, TransactionError, UnknownError }</li>
31
<a name="public-functions"></a>
32
<h3>Public Functions</h3>
34
<li><div class="fn"/><b><a href="qsqlerror.html#QSqlError">QSqlError</a></b> ( const QString & <i>driverText</i> = QString(), const QString & <i>databaseText</i> = QString(), ErrorType <i>type</i> = NoError, int <i>number</i> = -1 )</li>
35
<li><div class="fn"/><b><a href="qsqlerror.html#QSqlError-2">QSqlError</a></b> ( const QSqlError & <i>other</i> )</li>
36
<li><div class="fn"/><b><a href="qsqlerror.html#dtor.QSqlError">~QSqlError</a></b> ()</li>
37
<li><div class="fn"/>QString <b><a href="qsqlerror.html#databaseText">databaseText</a></b> () const</li>
38
<li><div class="fn"/>QString <b><a href="qsqlerror.html#driverText">driverText</a></b> () const</li>
39
<li><div class="fn"/>int <b><a href="qsqlerror.html#number">number</a></b> () const</li>
40
<li><div class="fn"/>void <b><a href="qsqlerror.html#setDatabaseText">setDatabaseText</a></b> ( const QString & <i>databaseText</i> )</li>
41
<li><div class="fn"/>void <b><a href="qsqlerror.html#setDriverText">setDriverText</a></b> ( const QString & <i>driverText</i> )</li>
42
<li><div class="fn"/>void <b><a href="qsqlerror.html#setNumber">setNumber</a></b> ( int <i>number</i> )</li>
43
<li><div class="fn"/>void <b><a href="qsqlerror.html#setType">setType</a></b> ( ErrorType <i>type</i> )</li>
44
<li><div class="fn"/>QString <b><a href="qsqlerror.html#text">text</a></b> () const</li>
45
<li><div class="fn"/>ErrorType <b><a href="qsqlerror.html#type">type</a></b> () const</li>
46
<li><div class="fn"/>QSqlError & <b><a href="qsqlerror.html#operator-eq">operator=</a></b> ( const QSqlError & <i>other</i> )</li>
48
<a name="details"></a>
50
<h2>Detailed Description</h2>
51
<p>The QSqlError class provides SQL database error information.</p>
52
<p>A QSqlError object can provide database-specific error data, including the <a href="qsqlerror.html#driverText">driverText</a>() and <a href="qsqlerror.html#databaseText">databaseText</a>() messages (or both concatenated together as <a href="qsqlerror.html#text">text</a>()), and the error <a href="qsqlerror.html#number">number</a>() and <a href="qsqlerror.html#type">type</a>(). The functions all have setters so that you can create and return QSqlError objects from your own classes, for example from your own SQL drivers.</p>
53
<p>See also <a href="qsqldatabase.html#lastError">QSqlDatabase::lastError</a>() and <a href="qsqlquery.html#lastError">QSqlQuery::lastError</a>().</p>
55
<h2>Member Type Documentation</h2>
56
<h3 class="fn"><a name="ErrorType-enum"></a>enum QSqlError::ErrorType</h3>
57
<p>This enum type describes the type of SQL error that occurred.</p>
58
<table border="1" cellpadding="2" cellspacing="1" width="100%">
59
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
60
<tr><td valign="top"><tt>QSqlError::NoError</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">No error occurred.</td></tr>
61
<tr><td valign="top"><tt>QSqlError::ConnectionError</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">Connection error.</td></tr>
62
<tr><td valign="top"><tt>QSqlError::StatementError</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">SQL statement syntax error.</td></tr>
63
<tr><td valign="top"><tt>QSqlError::TransactionError</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">Transaction failed error.</td></tr>
64
<tr><td valign="top"><tt>QSqlError::UnknownError</tt></td><td align="center" valign="top"><tt>4</tt></td><td valign="top">Unknown error.</td></tr>
67
<h2>Member Function Documentation</h2>
68
<h3 class="fn"><a name="QSqlError"></a>QSqlError::QSqlError ( const <a href="qstring.html">QString</a> & <i>driverText</i> = QString(), const <a href="qstring.html">QString</a> & <i>databaseText</i> = QString(), <a href="qsqlerror.html#ErrorType-enum">ErrorType</a> <i>type</i> = NoError, int <i>number</i> = -1 )</h3>
69
<p>Constructs an error containing the driver error text <i>driverText</i>, the database-specific error text <i>databaseText</i>, the type <i>type</i> and the optional error number <i>number</i>.</p>
70
<h3 class="fn"><a name="QSqlError-2"></a>QSqlError::QSqlError ( const QSqlError & <i>other</i> )</h3>
71
<p>Creates a copy of <i>other</i>.</p>
72
<h3 class="fn"><a name="dtor.QSqlError"></a>QSqlError::~QSqlError ()</h3>
73
<p>Destroys the object and frees any allocated resources.</p>
74
<h3 class="fn"><a name="databaseText"></a><a href="qstring.html">QString</a> QSqlError::databaseText () const</h3>
75
<p>Returns the text of the error as reported by the database. This may contain database-specific descriptions; it may be empty.</p>
76
<p>See also <a href="qsqlerror.html#setDatabaseText">setDatabaseText</a>(), <a href="qsqlerror.html#driverText">driverText</a>(), and <a href="qsqlerror.html#text">text</a>().</p>
77
<h3 class="fn"><a name="driverText"></a><a href="qstring.html">QString</a> QSqlError::driverText () const</h3>
78
<p>Returns the text of the error as reported by the driver. This may contain database-specific descriptions. It may also be empty.</p>
79
<p>See also <a href="qsqlerror.html#setDriverText">setDriverText</a>(), <a href="qsqlerror.html#databaseText">databaseText</a>(), and <a href="qsqlerror.html#text">text</a>().</p>
80
<h3 class="fn"><a name="number"></a>int QSqlError::number () const</h3>
81
<p>Returns the database-specific error number, or -1 if it cannot be determined.</p>
82
<p>See also <a href="qsqlerror.html#setNumber">setNumber</a>().</p>
83
<h3 class="fn"><a name="setDatabaseText"></a>void QSqlError::setDatabaseText ( const <a href="qstring.html">QString</a> & <i>databaseText</i> )</h3>
84
<p>Sets the database error text to the value of <i>databaseText</i>.</p>
85
<p>See also <a href="qsqlerror.html#databaseText">databaseText</a>(), <a href="qsqlerror.html#setDriverText">setDriverText</a>(), and <a href="qsqlerror.html#text">text</a>().</p>
86
<h3 class="fn"><a name="setDriverText"></a>void QSqlError::setDriverText ( const <a href="qstring.html">QString</a> & <i>driverText</i> )</h3>
87
<p>Sets the driver error text to the value of <i>driverText</i>.</p>
88
<p>See also <a href="qsqlerror.html#driverText">driverText</a>(), <a href="qsqlerror.html#setDatabaseText">setDatabaseText</a>(), and <a href="qsqlerror.html#text">text</a>().</p>
89
<h3 class="fn"><a name="setNumber"></a>void QSqlError::setNumber ( int <i>number</i> )</h3>
90
<p>Sets the database-specific error number to <i>number</i>.</p>
91
<p>See also <a href="qsqlerror.html#number">number</a>().</p>
92
<h3 class="fn"><a name="setType"></a>void QSqlError::setType ( <a href="qsqlerror.html#ErrorType-enum">ErrorType</a> <i>type</i> )</h3>
93
<p>Sets the error type to the value of <i>type</i>.</p>
94
<p>See also <a href="qsqlerror.html#type">type</a>().</p>
95
<h3 class="fn"><a name="text"></a><a href="qstring.html">QString</a> QSqlError::text () const</h3>
96
<p>This is a convenience function that returns <a href="qsqlerror.html#databaseText">databaseText</a>() and <a href="qsqlerror.html#driverText">driverText</a>() concatenated into a single string.</p>
97
<p>See also <a href="qsqlerror.html#driverText">driverText</a>() and <a href="qsqlerror.html#databaseText">databaseText</a>().</p>
98
<h3 class="fn"><a name="type"></a><a href="qsqlerror.html#ErrorType-enum">ErrorType</a> QSqlError::type () const</h3>
99
<p>Returns the error type, or -1 if the type cannot be determined.</p>
100
<p>See also <a href="qsqlerror.html#setType">setType</a>().</p>
101
<h3 class="fn"><a name="operator-eq"></a>QSqlError & QSqlError::operator= ( const QSqlError & <i>other</i> )</h3>
102
<p>Assigns the <i>other</i> error's values to this error.</p>
103
<p /><address><hr /><div align="center">
104
<table width="100%" cellspacing="0" border="0"><tr class="address">
105
<td width="30%">Copyright © 2005 <a href="trolltech.html">Trolltech</a></td>
106
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
107
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
108
</tr></table></div></address></body>