228 lines
13 KiB
228 lines
13 KiB
<!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/qsqlfield.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 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>
|
|
<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 <<a href="qsqlfield-h.html">ntqsqlfield.h</a>></tt>
|
|
<p><a href="qsqlfieldinfo-members.html">List of all member functions.</a>
|
|
<h2>Public Members</h2>
|
|
<ul>
|
|
<li class=fn><a href="#TQSqlFieldInfo"><b>TQSqlFieldInfo</b></a> ( const TQString & name = TQString::null, TQVariant::Type typ = TQVariant::Invalid, int required = -1, int len = -1, int prec = -1, const TQVariant & defValue = TQVariant ( ), int typeID = 0, bool generated = TRUE, bool trim = FALSE, bool calculated = FALSE )</li>
|
|
<li class=fn><a href="#TQSqlFieldInfo-2"><b>TQSqlFieldInfo</b></a> ( const TQSqlFieldInfo & other )</li>
|
|
<li class=fn><a href="#TQSqlFieldInfo-3"><b>TQSqlFieldInfo</b></a> ( const TQSqlField & other, bool generated = TRUE )</li>
|
|
<li class=fn>virtual <a href="#~TQSqlFieldInfo"><b>~TQSqlFieldInfo</b></a> ()</li>
|
|
<li class=fn>TQSqlFieldInfo & <a href="#operator-eq"><b>operator=</b></a> ( const TQSqlFieldInfo & other )</li>
|
|
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const TQSqlFieldInfo & 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 trim )</li>
|
|
<li class=fn>virtual void <a href="#setGenerated"><b>setGenerated</b></a> ( bool gen )</li>
|
|
<li class=fn>virtual void <a href="#setCalculated"><b>setCalculated</b></a> ( bool 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="ntqsqlfield.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 <a href="ntqstring.html">TQString</a> & name = TQString::null, <a href="ntqvariant.html#Type-enum">TQVariant::Type</a> typ = TQVariant::Invalid, int required = -1, int len = -1, int prec = -1, const <a href="ntqvariant.html">TQVariant</a> & defValue = TQVariant ( ), int typeID = 0, bool generated = TRUE, bool trim = FALSE, bool 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="ntqsqlcursor.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="ntqsqlcursor.html#calculateField">TQSqlCursor::calculateField</a>().
|
|
</table></center>
|
|
|
|
<h3 class=fn><a name="TQSqlFieldInfo-2"></a>TQSqlFieldInfo::TQSqlFieldInfo ( const <a href="qsqlfieldinfo.html">TQSqlFieldInfo</a> & other )
|
|
</h3>
|
|
Constructs a copy of <em>other</em>.
|
|
|
|
<h3 class=fn><a name="TQSqlFieldInfo-3"></a>TQSqlFieldInfo::TQSqlFieldInfo ( const <a href="ntqsqlfield.html">TQSqlField</a> & other, bool generated = TRUE )
|
|
</h3>
|
|
Creates a TQSqlFieldInfo object with the type and the name of the
|
|
<a href="ntqsqlfield.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="ntqsqlcursor.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="ntqsqlcursor.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="qsqlfieldinfo.html">TQSqlFieldInfo</a> & <a name="operator-eq"></a>TQSqlFieldInfo::operator= ( const <a href="qsqlfieldinfo.html">TQSqlFieldInfo</a> & 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 <a href="qsqlfieldinfo.html">TQSqlFieldInfo</a> & 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 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="ntqsqlcursor.html">TQSqlCursor</a> and overriding <a href="ntqsqlcursor.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 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="ntqsqlcursor.html">TQSqlCursor</a>).
|
|
<p> <p>See also <a href="#isGenerated">isGenerated</a>().
|
|
|
|
<h3 class=fn>void <a name="setTrim"></a>TQSqlFieldInfo::setTrim ( bool 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="ntqsqlfield.html">TQSqlField</a> <a name="toField"></a>TQSqlFieldInfo::toField () const
|
|
</h3>
|
|
Returns an empty <a href="ntqsqlfield.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 © 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 © 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>
|