source: trunk/doc/html/qsqlfieldinfo.html@ 208

Last change on this file since 208 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 13.0 KB
Line 
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"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { 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&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;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&nbsp;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 &lt;<a href="qsqlfield-h.html">qsqlfield.h</a>&gt;</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&nbsp;QString&nbsp;&amp;&nbsp;name = QString::null, QVariant::Type&nbsp;typ = QVariant::Invalid, int&nbsp;required = -1, int&nbsp;len = -1, int&nbsp;prec = -1, const&nbsp;QVariant&nbsp;&amp;&nbsp;defValue = QVariant ( ), int&nbsp;typeID = 0, bool&nbsp;generated = TRUE, bool&nbsp;trim = FALSE, bool&nbsp;calculated = FALSE )</li>
41<li class=fn><a href="#QSqlFieldInfo-2"><b>QSqlFieldInfo</b></a> ( const&nbsp;QSqlFieldInfo&nbsp;&amp;&nbsp;other )</li>
42<li class=fn><a href="#QSqlFieldInfo-3"><b>QSqlFieldInfo</b></a> ( const&nbsp;QSqlField&nbsp;&amp;&nbsp;other, bool&nbsp;generated = TRUE )</li>
43<li class=fn>virtual <a href="#~QSqlFieldInfo"><b>~QSqlFieldInfo</b></a> ()</li>
44<li class=fn>QSqlFieldInfo &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;QSqlFieldInfo&nbsp;&amp;&nbsp;other )</li>
45<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;QSqlFieldInfo&nbsp;&amp;&nbsp;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&nbsp;trim )</li>
58<li class=fn>virtual void <a href="#setGenerated"><b>setGenerated</b></a> ( bool&nbsp;gen )</li>
59<li class=fn>virtual void <a href="#setCalculated"><b>setCalculated</b></a> ( bool&nbsp;calc )</li>
60</ul>
61<hr><a name="details"></a><h2>Detailed Description</h2>
62
63
64The QSqlFieldInfo class stores meta data associated with a SQL field.
65<p>
66
67<p> QSqlFieldInfo objects only store meta data; field values are
68stored in <a href="qsqlfield.html">QSqlField</a> objects.
69<p> All values must be set in the constructor, and may be retrieved
70using <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&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;name = QString::null, <a href="qvariant.html#Type-enum">QVariant::Type</a>&nbsp;typ = QVariant::Invalid, int&nbsp;required = -1, int&nbsp;len = -1, int&nbsp;prec = -1, const&nbsp;<a href="qvariant.html">QVariant</a>&nbsp;&amp;&nbsp;defValue = QVariant ( ), int&nbsp;typeID = 0, bool&nbsp;generated = TRUE, bool&nbsp;trim = FALSE, bool&nbsp;calculated = FALSE )
76</h3>
77Constructs 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
82if its value can be NULL and less than 0 if it cannot be
83determined 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
85non-character types some databases return either the length in
86bytes or the number of digits. -1 signifies that the length cannot
87be determined.
88<tr bgcolor="#f0f0f0"> <td valign="top"><em>prec</em> <td valign="top">the precision of the field, or -1 if the field
89has 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
91the table if none is specified by the user. QVariant() if there is
92no 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
96included 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
98trailing whitespace from character fields. This does not affect
99the 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
101field is calculated. The value of calculated fields can by
102modified 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&nbsp;<a href="qsqlfieldinfo.html">QSqlFieldInfo</a>&nbsp;&amp;&nbsp;other )
107</h3>
108Constructs a copy of <em>other</em>.
109
110<h3 class=fn><a name="QSqlFieldInfo-3"></a>QSqlFieldInfo::QSqlFieldInfo ( const&nbsp;<a href="qsqlfield.html">QSqlField</a>&nbsp;&amp;&nbsp;other, bool&nbsp;generated = TRUE )
111</h3>
112Creates 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
114included 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>
118Destroys 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>
122Returns the field's default value or an empty <a href="qvariant.html">QVariant</a> if the
123field has no default value or the value couldn't be determined.
124The default value is the value inserted in the database when it
125is not explicitly specified by the user.
126
127<h3 class=fn>bool <a name="isCalculated"></a>QSqlFieldInfo::isCalculated () const
128</h3>
129Returns 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>
134Returns TRUE if the field should be included in auto-generated
135SQL 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>
140Returns a value greater than 0 if the field is required (NULL
141values are not allowed), 0 if it isn't required (NULL values are
142allowed) or less than 0 if it cannot be determined whether the
143field is required or not.
144
145<h3 class=fn>bool <a name="isTrim"></a>QSqlFieldInfo::isTrim () const
146</h3>
147Returns TRUE if trailing whitespace should be removed from
148character 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>
153Returns the field's length. For fields storing text the return
154value is the maximum number of characters the field can hold. For
155non-character fields some database systems return the number of
156bytes needed or the number of digits allowed. If the length cannot
157be determined -1 is returned.
158
159<h3 class=fn><a href="qstring.html">QString</a> <a name="name"></a>QSqlFieldInfo::name () const
160</h3>
161Returns 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>&nbsp;&amp; <a name="operator-eq"></a>QSqlFieldInfo::operator= ( const&nbsp;<a href="qsqlfieldinfo.html">QSqlFieldInfo</a>&nbsp;&amp;&nbsp;other )
165</h3>
166Assigns <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&nbsp;<a href="qsqlfieldinfo.html">QSqlFieldInfo</a>&nbsp;&amp;&nbsp;f ) const
169</h3>
170Returns TRUE if this fieldinfo is equal to <em>f</em>; otherwise returns
171FALSE.
172<p> Two field infos are considered equal if all their attributes
173match.
174
175<h3 class=fn>int <a name="precision"></a>QSqlFieldInfo::precision () const
176</h3>
177Returns the field's precision or -1 if the field has no precision
178or it cannot be determined.
179
180<h3 class=fn>void <a name="setCalculated"></a>QSqlFieldInfo::setCalculated ( bool&nbsp;calc )<tt> [virtual]</tt>
181</h3>
182<em>calc</em> set to TRUE indicates that this field is a calculated
183field. 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&nbsp;gen )<tt> [virtual]</tt>
188</h3>
189<em>gen</em> set to FALSE indicates that this field should not appear
190in 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&nbsp;trim )<tt> [virtual]</tt>
194</h3>
195If <em>trim</em> is TRUE widgets should remove trailing whitespace from
196character fields. This does not affect the field value but only
197its 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>
202Returns an empty <a href="qsqlfield.html">QSqlField</a> based on the information in this
203QSqlFieldInfo.
204
205<h3 class=fn><a href="qvariant.html#Type-enum">QVariant::Type</a> <a name="type"></a>QSqlFieldInfo::type () const
206</h3>
207Returns the field's type or QVariant::Invalid if the type is
208unknown.
209
210<h3 class=fn>int <a name="typeID"></a>QSqlFieldInfo::typeID () const
211</h3>
212Returns the internal type identifier as returned from the database
213system. The return value is 0 if the type is unknown.
214<p> <b>Warning:</b> This information is only useful for low-level database
215programming and is <em>not</em> database independent.
216
217<!-- eof -->
218<hr><p>
219This file is part of the <a href="index.html">Qt toolkit</a>.
220Copyright &copy; 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 &copy; 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>
Note: See TracBrowser for help on using the repository browser.