summaryrefslogtreecommitdiffstats
path: root/doc/html/tqsqlfieldinfo.html
blob: 64909fb3b3d26d2396dd6c916b03601a6e1e562c (plain)
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/sql/tqsqlfield.cpp:304 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQSqlFieldInfo Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQSqlFieldInfo Class Reference<br><small>[<a href="sql.html">sql module</a>]</small></h1>

<p>The TQSqlFieldInfo class stores meta data associated with a SQL field.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="tqsqlfield-h.html">tqsqlfield.h</a>&gt;</tt>
<p><a href="tqsqlfieldinfo-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQSqlFieldInfo"><b>TQSqlFieldInfo</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;name = TQString::null, TQVariant::Type&nbsp;typ = TQVariant::Invalid, int&nbsp;required = -1, int&nbsp;len = -1, int&nbsp;prec = -1, const&nbsp;TQVariant&nbsp;&amp;&nbsp;defValue = TQVariant ( ), int&nbsp;typeID = 0, bool&nbsp;generated = TRUE, bool&nbsp;trim = FALSE, bool&nbsp;calculated = FALSE )</li>
<li class=fn><a href="#TQSqlFieldInfo-2"><b>TQSqlFieldInfo</b></a> ( const&nbsp;TQSqlFieldInfo&nbsp;&amp;&nbsp;other )</li>
<li class=fn><a href="#TQSqlFieldInfo-3"><b>TQSqlFieldInfo</b></a> ( const&nbsp;TQSqlField&nbsp;&amp;&nbsp;other, bool&nbsp;generated = TRUE )</li>
<li class=fn>virtual <a href="#~TQSqlFieldInfo"><b>~TQSqlFieldInfo</b></a> ()</li>
<li class=fn>TQSqlFieldInfo &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;TQSqlFieldInfo&nbsp;&amp;&nbsp;other )</li>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;TQSqlFieldInfo&nbsp;&amp;&nbsp;f ) const</li>
<li class=fn>TQSqlField <a href="#toField"><b>toField</b></a> () const</li>
<li class=fn>int <a href="#isRequired"><b>isRequired</b></a> () const</li>
<li class=fn>TQVariant::Type <a href="#type"><b>type</b></a> () const</li>
<li class=fn>int <a href="#length"><b>length</b></a> () const</li>
<li class=fn>int <a href="#precision"><b>precision</b></a> () const</li>
<li class=fn>TQVariant <a href="#defaultValue"><b>defaultValue</b></a> () const</li>
<li class=fn>TQString <a href="#name"><b>name</b></a> () const</li>
<li class=fn>int <a href="#typeID"><b>typeID</b></a> () const</li>
<li class=fn>bool <a href="#isGenerated"><b>isGenerated</b></a> () const</li>
<li class=fn>bool <a href="#isTrim"><b>isTrim</b></a> () const</li>
<li class=fn>bool <a href="#isCalculated"><b>isCalculated</b></a> () const</li>
<li class=fn>virtual void <a href="#setTrim"><b>setTrim</b></a> ( bool&nbsp;trim )</li>
<li class=fn>virtual void <a href="#setGenerated"><b>setGenerated</b></a> ( bool&nbsp;gen )</li>
<li class=fn>virtual void <a href="#setCalculated"><b>setCalculated</b></a> ( bool&nbsp;calc )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The TQSqlFieldInfo class stores meta data associated with a SQL field.
<p> 

<p> TQSqlFieldInfo objects only store meta data; field values are
stored in <a href="tqsqlfield.html">TQSqlField</a> objects.
<p> All values must be set in the constructor, and may be retrieved
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>(),
<a href="#name">name</a>(), <a href="#isGenerated">isGenerated</a>() and <a href="#typeID">typeID</a>().
<p>See also <a href="database.html">Database Classes</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQSqlFieldInfo"></a>TQSqlFieldInfo::TQSqlFieldInfo ( const&nbsp;<a href="ntqstring.html">TQString</a>&nbsp;&amp;&nbsp;name = TQString::null, <a href="ntqvariant.html#Type-enum">TQVariant::Type</a>&nbsp;typ = TQVariant::Invalid, int&nbsp;required = -1, int&nbsp;len = -1, int&nbsp;prec = -1, const&nbsp;<a href="ntqvariant.html">TQVariant</a>&nbsp;&amp;&nbsp;defValue = TQVariant ( ), int&nbsp;typeID = 0, bool&nbsp;generated = TRUE, bool&nbsp;trim = FALSE, bool&nbsp;calculated = FALSE )
</h3>
Constructs a TQSqlFieldInfo with the following parameters:
<center><table cellpadding="4" cellspacing="2" border="0">
<tr bgcolor="#f0f0f0"> <td valign="top"><em>name</em>  <td valign="top">the name of the field.
<tr bgcolor="#d0d0d0"> <td valign="top"><em>typ</em>   <td valign="top">the field's type in a <a href="ntqvariant.html">TQVariant</a>.
<tr bgcolor="#f0f0f0"> <td valign="top"><em>required</em>  <td valign="top">greater than 0 if the field is required, 0
if its value can be NULL and less than 0 if it cannot be
determined whether the field is required or not.
<tr bgcolor="#d0d0d0"> <td valign="top"><em>len</em>  <td valign="top">the length of the field. Note that for
non-character types some databases return either the length in
bytes or the number of digits. -1 signifies that the length cannot
be determined.
<tr bgcolor="#f0f0f0"> <td valign="top"><em>prec</em>  <td valign="top">the precision of the field, or -1 if the field
has no precision or it cannot be determined.
<tr bgcolor="#d0d0d0"> <td valign="top"><em>defValue</em>  <td valign="top">the default value that is inserted into
the table if none is specified by the user. TQVariant() if there is
no default value or it cannot be determined.
<tr bgcolor="#f0f0f0"> <td valign="top"><em>typeID</em>  <td valign="top">the internal typeID of the database system
(only useful for low-level programming). 0 if unknown.
<tr bgcolor="#d0d0d0"> <td valign="top"><em>generated</em>  <td valign="top">TRUE indicates that this field should be
included in auto-generated SQL statments, e.g. in <a href="tqsqlcursor.html">TQSqlCursor</a>.
<tr bgcolor="#f0f0f0"> <td valign="top"><em>trim</em>  <td valign="top">TRUE indicates that widgets should remove
trailing whitespace from character fields. This does not affect
the field value but only its representation inside widgets.
<tr bgcolor="#d0d0d0"> <td valign="top"><em>calculated</em>  <td valign="top">TRUE indicates that the value of this
field is calculated. The value of calculated fields can by
modified by subclassing TQSqlCursor and overriding
<a href="tqsqlcursor.html#calculateField">TQSqlCursor::calculateField</a>().
</table></center>

<h3 class=fn><a name="TQSqlFieldInfo-2"></a>TQSqlFieldInfo::TQSqlFieldInfo ( const&nbsp;<a href="tqsqlfieldinfo.html">TQSqlFieldInfo</a>&nbsp;&amp;&nbsp;other )
</h3>
Constructs a copy of <em>other</em>.

<h3 class=fn><a name="TQSqlFieldInfo-3"></a>TQSqlFieldInfo::TQSqlFieldInfo ( const&nbsp;<a href="tqsqlfield.html">TQSqlField</a>&nbsp;&amp;&nbsp;other, bool&nbsp;generated = TRUE )
</h3>
Creates a TQSqlFieldInfo object with the type and the name of the
<a href="tqsqlfield.html">TQSqlField</a> <em>other</em>. If <em>generated</em> is TRUE this field will be
included in auto-generated SQL statments, e.g. in <a href="tqsqlcursor.html">TQSqlCursor</a>.

<h3 class=fn><a name="~TQSqlFieldInfo"></a>TQSqlFieldInfo::~TQSqlFieldInfo ()<tt> [virtual]</tt>
</h3>
Destroys the object and frees any allocated resources.

<h3 class=fn><a href="ntqvariant.html">TQVariant</a> <a name="defaultValue"></a>TQSqlFieldInfo::defaultValue () const
</h3>
Returns the field's default value or an empty <a href="ntqvariant.html">TQVariant</a> if the
field has no default value or the value couldn't be determined.
The default value is the value inserted in the database when it
is not explicitly specified by the user.

<h3 class=fn>bool <a name="isCalculated"></a>TQSqlFieldInfo::isCalculated () const
</h3>
Returns TRUE if the field is calculated; otherwise returns FALSE.
<p> <p>See also <a href="#setCalculated">setCalculated</a>().

<h3 class=fn>bool <a name="isGenerated"></a>TQSqlFieldInfo::isGenerated () const
</h3>
Returns TRUE if the field should be included in auto-generated
SQL statments, e.g. in <a href="tqsqlcursor.html">TQSqlCursor</a>; otherwise returns FALSE.
<p> <p>See also <a href="#setGenerated">setGenerated</a>().

<h3 class=fn>int <a name="isRequired"></a>TQSqlFieldInfo::isRequired () const
</h3>
Returns a value greater than 0 if the field is required (NULL
values are not allowed), 0 if it isn't required (NULL values are
allowed) or less than 0 if it cannot be determined whether the
field is required or not.

<h3 class=fn>bool <a name="isTrim"></a>TQSqlFieldInfo::isTrim () const
</h3>
Returns TRUE if trailing whitespace should be removed from
character fields; otherwise returns FALSE.
<p> <p>See also <a href="#setTrim">setTrim</a>().

<h3 class=fn>int <a name="length"></a>TQSqlFieldInfo::length () const
</h3>
Returns the field's length. For fields storing text the return
value is the maximum number of characters the field can hold. For
non-character fields some database systems return the number of
bytes needed or the number of digits allowed. If the length cannot
be determined -1 is returned.

<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="name"></a>TQSqlFieldInfo::name () const
</h3>
Returns the name of the field in the SQL table.

<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>.
<h3 class=fn><a href="tqsqlfieldinfo.html">TQSqlFieldInfo</a>&nbsp;&amp; <a name="operator-eq"></a>TQSqlFieldInfo::operator= ( const&nbsp;<a href="tqsqlfieldinfo.html">TQSqlFieldInfo</a>&nbsp;&amp;&nbsp;other )
</h3>
Assigns <em>other</em> to this field info and returns a reference to it.

<h3 class=fn>bool <a name="operator-eq-eq"></a>TQSqlFieldInfo::operator== ( const&nbsp;<a href="tqsqlfieldinfo.html">TQSqlFieldInfo</a>&nbsp;&amp;&nbsp;f ) const
</h3>
Returns TRUE if this fieldinfo is equal to <em>f</em>; otherwise returns
FALSE.
<p> Two field infos are considered equal if all their attributes
match.

<h3 class=fn>int <a name="precision"></a>TQSqlFieldInfo::precision () const
</h3>
Returns the field's precision or -1 if the field has no precision
or it cannot be determined.

<h3 class=fn>void <a name="setCalculated"></a>TQSqlFieldInfo::setCalculated ( bool&nbsp;calc )<tt> [virtual]</tt>
</h3>
<em>calc</em> set to TRUE indicates that this field is a calculated
field. The value of calculated fields can by modified by subclassing
<a href="tqsqlcursor.html">TQSqlCursor</a> and overriding <a href="tqsqlcursor.html#calculateField">TQSqlCursor::calculateField</a>().
<p> <p>See also <a href="#isCalculated">isCalculated</a>().

<h3 class=fn>void <a name="setGenerated"></a>TQSqlFieldInfo::setGenerated ( bool&nbsp;gen )<tt> [virtual]</tt>
</h3>
<em>gen</em> set to FALSE indicates that this field should not appear
in auto-generated SQL statements (for example in <a href="tqsqlcursor.html">TQSqlCursor</a>).
<p> <p>See also <a href="#isGenerated">isGenerated</a>().

<h3 class=fn>void <a name="setTrim"></a>TQSqlFieldInfo::setTrim ( bool&nbsp;trim )<tt> [virtual]</tt>
</h3>
If <em>trim</em> is TRUE widgets should remove trailing whitespace from
character fields. This does not affect the field value but only
its representation inside widgets.
<p> <p>See also <a href="#isTrim">isTrim</a>().

<h3 class=fn><a href="tqsqlfield.html">TQSqlField</a> <a name="toField"></a>TQSqlFieldInfo::toField () const
</h3>
Returns an empty <a href="tqsqlfield.html">TQSqlField</a> based on the information in this
TQSqlFieldInfo.

<h3 class=fn><a href="ntqvariant.html#Type-enum">TQVariant::Type</a> <a name="type"></a>TQSqlFieldInfo::type () const
</h3>
Returns the field's type or TQVariant::Invalid if the type is
unknown.

<h3 class=fn>int <a name="typeID"></a>TQSqlFieldInfo::typeID () const
</h3>
Returns the internal type identifier as returned from the database
system. The return value is 0 if the type is unknown.
<p> <b>Warning:</b> This information is only useful for low-level database
programming and is <em>not</em> database independent.

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>