[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/sql/qsqlfield.cpp:304 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QSqlFieldInfo Class</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QSqlFieldInfo Class Reference<br><small>[<a href="sql.html">sql module</a>]</small></h1>
|
---|
| 33 |
|
---|
| 34 | <p>The QSqlFieldInfo class stores meta data associated with a SQL field.
|
---|
| 35 | <a href="#details">More...</a>
|
---|
| 36 | <p><tt>#include <<a href="qsqlfield-h.html">qsqlfield.h</a>></tt>
|
---|
| 37 | <p><a href="qsqlfieldinfo-members.html">List of all member functions.</a>
|
---|
| 38 | <h2>Public Members</h2>
|
---|
| 39 | <ul>
|
---|
| 40 | <li class=fn><a href="#QSqlFieldInfo"><b>QSqlFieldInfo</b></a> ( const QString & name = QString::null, QVariant::Type typ = QVariant::Invalid, int required = -1, int len = -1, int prec = -1, const QVariant & defValue = QVariant ( ), int typeID = 0, bool generated = TRUE, bool trim = FALSE, bool calculated = FALSE )</li>
|
---|
| 41 | <li class=fn><a href="#QSqlFieldInfo-2"><b>QSqlFieldInfo</b></a> ( const QSqlFieldInfo & other )</li>
|
---|
| 42 | <li class=fn><a href="#QSqlFieldInfo-3"><b>QSqlFieldInfo</b></a> ( const QSqlField & other, bool generated = TRUE )</li>
|
---|
| 43 | <li class=fn>virtual <a href="#~QSqlFieldInfo"><b>~QSqlFieldInfo</b></a> ()</li>
|
---|
| 44 | <li class=fn>QSqlFieldInfo & <a href="#operator-eq"><b>operator=</b></a> ( const QSqlFieldInfo & other )</li>
|
---|
| 45 | <li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QSqlFieldInfo & f ) const</li>
|
---|
| 46 | <li class=fn>QSqlField <a href="#toField"><b>toField</b></a> () const</li>
|
---|
| 47 | <li class=fn>int <a href="#isRequired"><b>isRequired</b></a> () const</li>
|
---|
| 48 | <li class=fn>QVariant::Type <a href="#type"><b>type</b></a> () const</li>
|
---|
| 49 | <li class=fn>int <a href="#length"><b>length</b></a> () const</li>
|
---|
| 50 | <li class=fn>int <a href="#precision"><b>precision</b></a> () const</li>
|
---|
| 51 | <li class=fn>QVariant <a href="#defaultValue"><b>defaultValue</b></a> () const</li>
|
---|
| 52 | <li class=fn>QString <a href="#name"><b>name</b></a> () const</li>
|
---|
| 53 | <li class=fn>int <a href="#typeID"><b>typeID</b></a> () const</li>
|
---|
| 54 | <li class=fn>bool <a href="#isGenerated"><b>isGenerated</b></a> () const</li>
|
---|
| 55 | <li class=fn>bool <a href="#isTrim"><b>isTrim</b></a> () const</li>
|
---|
| 56 | <li class=fn>bool <a href="#isCalculated"><b>isCalculated</b></a> () const</li>
|
---|
| 57 | <li class=fn>virtual void <a href="#setTrim"><b>setTrim</b></a> ( bool trim )</li>
|
---|
| 58 | <li class=fn>virtual void <a href="#setGenerated"><b>setGenerated</b></a> ( bool gen )</li>
|
---|
| 59 | <li class=fn>virtual void <a href="#setCalculated"><b>setCalculated</b></a> ( bool calc )</li>
|
---|
| 60 | </ul>
|
---|
| 61 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 62 |
|
---|
| 63 |
|
---|
| 64 | The QSqlFieldInfo class stores meta data associated with a SQL field.
|
---|
| 65 | <p>
|
---|
| 66 |
|
---|
| 67 | <p> QSqlFieldInfo objects only store meta data; field values are
|
---|
| 68 | stored in <a href="qsqlfield.html">QSqlField</a> objects.
|
---|
| 69 | <p> All values must be set in the constructor, and may be retrieved
|
---|
| 70 | using <a href="#isRequired">isRequired</a>(), <a href="#type">type</a>(), <a href="#length">length</a>(), <a href="#precision">precision</a>(), <a href="#defaultValue">defaultValue</a>(),
|
---|
| 71 | <a href="#name">name</a>(), <a href="#isGenerated">isGenerated</a>() and <a href="#typeID">typeID</a>().
|
---|
| 72 | <p>See also <a href="database.html">Database Classes</a>.
|
---|
| 73 |
|
---|
| 74 | <hr><h2>Member Function Documentation</h2>
|
---|
| 75 | <h3 class=fn><a name="QSqlFieldInfo"></a>QSqlFieldInfo::QSqlFieldInfo ( const <a href="qstring.html">QString</a> & name = QString::null, <a href="qvariant.html#Type-enum">QVariant::Type</a> typ = QVariant::Invalid, int required = -1, int len = -1, int prec = -1, const <a href="qvariant.html">QVariant</a> & defValue = QVariant ( ), int typeID = 0, bool generated = TRUE, bool trim = FALSE, bool calculated = FALSE )
|
---|
| 76 | </h3>
|
---|
| 77 | Constructs a QSqlFieldInfo with the following parameters:
|
---|
| 78 | <center><table cellpadding="4" cellspacing="2" border="0">
|
---|
| 79 | <tr bgcolor="#f0f0f0"> <td valign="top"><em>name</em> <td valign="top">the name of the field.
|
---|
| 80 | <tr bgcolor="#d0d0d0"> <td valign="top"><em>typ</em> <td valign="top">the field's type in a <a href="qvariant.html">QVariant</a>.
|
---|
| 81 | <tr bgcolor="#f0f0f0"> <td valign="top"><em>required</em> <td valign="top">greater than 0 if the field is required, 0
|
---|
| 82 | if its value can be NULL and less than 0 if it cannot be
|
---|
| 83 | determined whether the field is required or not.
|
---|
| 84 | <tr bgcolor="#d0d0d0"> <td valign="top"><em>len</em> <td valign="top">the length of the field. Note that for
|
---|
| 85 | non-character types some databases return either the length in
|
---|
| 86 | bytes or the number of digits. -1 signifies that the length cannot
|
---|
| 87 | be determined.
|
---|
| 88 | <tr bgcolor="#f0f0f0"> <td valign="top"><em>prec</em> <td valign="top">the precision of the field, or -1 if the field
|
---|
| 89 | has no precision or it cannot be determined.
|
---|
| 90 | <tr bgcolor="#d0d0d0"> <td valign="top"><em>defValue</em> <td valign="top">the default value that is inserted into
|
---|
| 91 | the table if none is specified by the user. QVariant() if there is
|
---|
| 92 | no default value or it cannot be determined.
|
---|
| 93 | <tr bgcolor="#f0f0f0"> <td valign="top"><em>typeID</em> <td valign="top">the internal typeID of the database system
|
---|
| 94 | (only useful for low-level programming). 0 if unknown.
|
---|
| 95 | <tr bgcolor="#d0d0d0"> <td valign="top"><em>generated</em> <td valign="top">TRUE indicates that this field should be
|
---|
| 96 | included in auto-generated SQL statments, e.g. in <a href="qsqlcursor.html">QSqlCursor</a>.
|
---|
| 97 | <tr bgcolor="#f0f0f0"> <td valign="top"><em>trim</em> <td valign="top">TRUE indicates that widgets should remove
|
---|
| 98 | trailing whitespace from character fields. This does not affect
|
---|
| 99 | the field value but only its representation inside widgets.
|
---|
| 100 | <tr bgcolor="#d0d0d0"> <td valign="top"><em>calculated</em> <td valign="top">TRUE indicates that the value of this
|
---|
| 101 | field is calculated. The value of calculated fields can by
|
---|
| 102 | modified by subclassing QSqlCursor and overriding
|
---|
| 103 | <a href="qsqlcursor.html#calculateField">QSqlCursor::calculateField</a>().
|
---|
| 104 | </table></center>
|
---|
| 105 |
|
---|
| 106 | <h3 class=fn><a name="QSqlFieldInfo-2"></a>QSqlFieldInfo::QSqlFieldInfo ( const <a href="qsqlfieldinfo.html">QSqlFieldInfo</a> & other )
|
---|
| 107 | </h3>
|
---|
| 108 | Constructs a copy of <em>other</em>.
|
---|
| 109 |
|
---|
| 110 | <h3 class=fn><a name="QSqlFieldInfo-3"></a>QSqlFieldInfo::QSqlFieldInfo ( const <a href="qsqlfield.html">QSqlField</a> & other, bool generated = TRUE )
|
---|
| 111 | </h3>
|
---|
| 112 | Creates a QSqlFieldInfo object with the type and the name of the
|
---|
| 113 | <a href="qsqlfield.html">QSqlField</a> <em>other</em>. If <em>generated</em> is TRUE this field will be
|
---|
| 114 | included in auto-generated SQL statments, e.g. in <a href="qsqlcursor.html">QSqlCursor</a>.
|
---|
| 115 |
|
---|
| 116 | <h3 class=fn><a name="~QSqlFieldInfo"></a>QSqlFieldInfo::~QSqlFieldInfo ()<tt> [virtual]</tt>
|
---|
| 117 | </h3>
|
---|
| 118 | Destroys the object and frees any allocated resources.
|
---|
| 119 |
|
---|
| 120 | <h3 class=fn><a href="qvariant.html">QVariant</a> <a name="defaultValue"></a>QSqlFieldInfo::defaultValue () const
|
---|
| 121 | </h3>
|
---|
| 122 | Returns the field's default value or an empty <a href="qvariant.html">QVariant</a> if the
|
---|
| 123 | field has no default value or the value couldn't be determined.
|
---|
| 124 | The default value is the value inserted in the database when it
|
---|
| 125 | is not explicitly specified by the user.
|
---|
| 126 |
|
---|
| 127 | <h3 class=fn>bool <a name="isCalculated"></a>QSqlFieldInfo::isCalculated () const
|
---|
| 128 | </h3>
|
---|
| 129 | Returns TRUE if the field is calculated; otherwise returns FALSE.
|
---|
| 130 | <p> <p>See also <a href="#setCalculated">setCalculated</a>().
|
---|
| 131 |
|
---|
| 132 | <h3 class=fn>bool <a name="isGenerated"></a>QSqlFieldInfo::isGenerated () const
|
---|
| 133 | </h3>
|
---|
| 134 | Returns TRUE if the field should be included in auto-generated
|
---|
| 135 | SQL statments, e.g. in <a href="qsqlcursor.html">QSqlCursor</a>; otherwise returns FALSE.
|
---|
| 136 | <p> <p>See also <a href="#setGenerated">setGenerated</a>().
|
---|
| 137 |
|
---|
| 138 | <h3 class=fn>int <a name="isRequired"></a>QSqlFieldInfo::isRequired () const
|
---|
| 139 | </h3>
|
---|
| 140 | Returns a value greater than 0 if the field is required (NULL
|
---|
| 141 | values are not allowed), 0 if it isn't required (NULL values are
|
---|
| 142 | allowed) or less than 0 if it cannot be determined whether the
|
---|
| 143 | field is required or not.
|
---|
| 144 |
|
---|
| 145 | <h3 class=fn>bool <a name="isTrim"></a>QSqlFieldInfo::isTrim () const
|
---|
| 146 | </h3>
|
---|
| 147 | Returns TRUE if trailing whitespace should be removed from
|
---|
| 148 | character fields; otherwise returns FALSE.
|
---|
| 149 | <p> <p>See also <a href="#setTrim">setTrim</a>().
|
---|
| 150 |
|
---|
| 151 | <h3 class=fn>int <a name="length"></a>QSqlFieldInfo::length () const
|
---|
| 152 | </h3>
|
---|
| 153 | Returns the field's length. For fields storing text the return
|
---|
| 154 | value is the maximum number of characters the field can hold. For
|
---|
| 155 | non-character fields some database systems return the number of
|
---|
| 156 | bytes needed or the number of digits allowed. If the length cannot
|
---|
| 157 | be determined -1 is returned.
|
---|
| 158 |
|
---|
| 159 | <h3 class=fn><a href="qstring.html">QString</a> <a name="name"></a>QSqlFieldInfo::name () const
|
---|
| 160 | </h3>
|
---|
| 161 | Returns the name of the field in the SQL table.
|
---|
| 162 |
|
---|
| 163 | <p>Examples: <a href="sql.html#x2260">sql/overview/subclass3/main.cpp</a> and <a href="sql.html#x2264">sql/overview/subclass4/main.cpp</a>.
|
---|
| 164 | <h3 class=fn><a href="qsqlfieldinfo.html">QSqlFieldInfo</a> & <a name="operator-eq"></a>QSqlFieldInfo::operator= ( const <a href="qsqlfieldinfo.html">QSqlFieldInfo</a> & other )
|
---|
| 165 | </h3>
|
---|
| 166 | Assigns <em>other</em> to this field info and returns a reference to it.
|
---|
| 167 |
|
---|
| 168 | <h3 class=fn>bool <a name="operator-eq-eq"></a>QSqlFieldInfo::operator== ( const <a href="qsqlfieldinfo.html">QSqlFieldInfo</a> & f ) const
|
---|
| 169 | </h3>
|
---|
| 170 | Returns TRUE if this fieldinfo is equal to <em>f</em>; otherwise returns
|
---|
| 171 | FALSE.
|
---|
| 172 | <p> Two field infos are considered equal if all their attributes
|
---|
| 173 | match.
|
---|
| 174 |
|
---|
| 175 | <h3 class=fn>int <a name="precision"></a>QSqlFieldInfo::precision () const
|
---|
| 176 | </h3>
|
---|
| 177 | Returns the field's precision or -1 if the field has no precision
|
---|
| 178 | or it cannot be determined.
|
---|
| 179 |
|
---|
| 180 | <h3 class=fn>void <a name="setCalculated"></a>QSqlFieldInfo::setCalculated ( bool calc )<tt> [virtual]</tt>
|
---|
| 181 | </h3>
|
---|
| 182 | <em>calc</em> set to TRUE indicates that this field is a calculated
|
---|
| 183 | field. The value of calculated fields can by modified by subclassing
|
---|
| 184 | <a href="qsqlcursor.html">QSqlCursor</a> and overriding <a href="qsqlcursor.html#calculateField">QSqlCursor::calculateField</a>().
|
---|
| 185 | <p> <p>See also <a href="#isCalculated">isCalculated</a>().
|
---|
| 186 |
|
---|
| 187 | <h3 class=fn>void <a name="setGenerated"></a>QSqlFieldInfo::setGenerated ( bool gen )<tt> [virtual]</tt>
|
---|
| 188 | </h3>
|
---|
| 189 | <em>gen</em> set to FALSE indicates that this field should not appear
|
---|
| 190 | in auto-generated SQL statements (for example in <a href="qsqlcursor.html">QSqlCursor</a>).
|
---|
| 191 | <p> <p>See also <a href="#isGenerated">isGenerated</a>().
|
---|
| 192 |
|
---|
| 193 | <h3 class=fn>void <a name="setTrim"></a>QSqlFieldInfo::setTrim ( bool trim )<tt> [virtual]</tt>
|
---|
| 194 | </h3>
|
---|
| 195 | If <em>trim</em> is TRUE widgets should remove trailing whitespace from
|
---|
| 196 | character fields. This does not affect the field value but only
|
---|
| 197 | its representation inside widgets.
|
---|
| 198 | <p> <p>See also <a href="#isTrim">isTrim</a>().
|
---|
| 199 |
|
---|
| 200 | <h3 class=fn><a href="qsqlfield.html">QSqlField</a> <a name="toField"></a>QSqlFieldInfo::toField () const
|
---|
| 201 | </h3>
|
---|
| 202 | Returns an empty <a href="qsqlfield.html">QSqlField</a> based on the information in this
|
---|
| 203 | QSqlFieldInfo.
|
---|
| 204 |
|
---|
| 205 | <h3 class=fn><a href="qvariant.html#Type-enum">QVariant::Type</a> <a name="type"></a>QSqlFieldInfo::type () const
|
---|
| 206 | </h3>
|
---|
| 207 | Returns the field's type or QVariant::Invalid if the type is
|
---|
| 208 | unknown.
|
---|
| 209 |
|
---|
| 210 | <h3 class=fn>int <a name="typeID"></a>QSqlFieldInfo::typeID () const
|
---|
| 211 | </h3>
|
---|
| 212 | Returns the internal type identifier as returned from the database
|
---|
| 213 | system. The return value is 0 if the type is unknown.
|
---|
| 214 | <p> <b>Warning:</b> This information is only useful for low-level database
|
---|
| 215 | programming and is <em>not</em> database independent.
|
---|
| 216 |
|
---|
| 217 | <!-- eof -->
|
---|
| 218 | <hr><p>
|
---|
| 219 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 220 | Copyright © 1995-2007
|
---|
| 221 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 222 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 223 | <td>Copyright © 2007
|
---|
| 224 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 225 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 226 | </table></div></address></body>
|
---|
| 227 | </html>
|
---|