Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 112b0974ad288f6cd55bf971ee6026a9 > files > 1826

libqt3-devel-3.0.2-2mdk.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/sql/qsqlfield.cpp:287 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QSqlFieldInfo Class</title>
<style type="text/css"><!--
h3.fn,span.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>QSqlFieldInfo Class Reference<br><small>[<a href="sql.html">sql module</a>]</small></h1>

<p>The QSqlFieldInfo class stores meta data associated with a SQL field.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qsqlfield-h.html">qsqlfield.h</a>&gt;</tt>
<p><a href="qsqlfieldinfo-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li><div 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 )</div></li>
<li><div class=fn><a href="#QSqlFieldInfo-2"><b>QSqlFieldInfo</b></a> ( const&nbsp;QSqlFieldInfo&nbsp;&amp;&nbsp;other )</div></li>
<li><div class=fn><a href="#QSqlFieldInfo-3"><b>QSqlFieldInfo</b></a> ( const&nbsp;QSqlField&nbsp;&amp;&nbsp;other, bool&nbsp;generated = TRUE )</div></li>
<li><div class=fn>virtual <a href="#~QSqlFieldInfo"><b>~QSqlFieldInfo</b></a> ()</div></li>
<li><div class=fn>QSqlFieldInfo &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;QSqlFieldInfo&nbsp;&amp;&nbsp;other )</div></li>
<li><div class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;QSqlFieldInfo&nbsp;&amp;&nbsp;f ) const</div></li>
<li><div class=fn>QSqlField <a href="#toField"><b>toField</b></a> () const</div></li>
<li><div class=fn>int <a href="#isRequired"><b>isRequired</b></a> () const</div></li>
<li><div class=fn>QVariant::Type <a href="#type"><b>type</b></a> () const</div></li>
<li><div class=fn>int <a href="#length"><b>length</b></a> () const</div></li>
<li><div class=fn>int <a href="#precision"><b>precision</b></a> () const</div></li>
<li><div class=fn>QVariant <a href="#defaultValue"><b>defaultValue</b></a> () const</div></li>
<li><div class=fn>QString <a href="#name"><b>name</b></a> () const</div></li>
<li><div class=fn>int <a href="#typeID"><b>typeID</b></a> () const</div></li>
<li><div class=fn>bool <a href="#isGenerated"><b>isGenerated</b></a> () const</div></li>
<li><div class=fn>bool <a href="#isTrim"><b>isTrim</b></a> () const</div></li>
<li><div class=fn>bool <a href="#isCalculated"><b>isCalculated</b></a> () const</div></li>
<li><div class=fn>virtual void <a href="#setTrim"><b>setTrim</b></a> ( bool&nbsp;trim )</div></li>
<li><div class=fn>virtual void <a href="#setGenerated"><b>setGenerated</b></a> ( bool&nbsp;gen )</div></li>
<li><div class=fn>virtual void <a href="#setCalculated"><b>setCalculated</b></a> ( bool&nbsp;calc )</div></li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>



The QSqlFieldInfo class stores meta data associated with a SQL field.

<p> QSqlFieldInfo objects only store meta data; field values are
stored in <a href="qsqlfield.html">QSqlField</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="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 )
</h3>
Constructs a QSqlFieldInfo with the following parameters:
<ul>
<li> <em>name</em>  the name of the field.
<li> <em>typ</em>   the field's type in a <a href="qvariant.html">QVariant</a>.
<li> <em>required</em>  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.
<li> <em>len</em>  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.
<li> <em>prec</em>  the precision of the field, or -1 if the field has no
precision or it cannot be determined.
<li> <em>defValue</em>  the default value that is inserted into the table if
none is specified by the user. QVariant() if there is no default
value or it cannot be determined.
<li> <em>typeID</em>  the internal typeID of the database system (only
useful for low-level programming). 0 if unknown.
<li> <em>generated</em>  TRUE indicates that this field should be included
in auto-generated SQL statments, e.g. in <a href="qsqlcursor.html">QSqlCursor</a>.
<li> <em>trim</em>  TRUE indicates that widgets should remove trailing
whitespace from character fields. This does not affect the field
value but only its representation inside widgets.
<li> <em>calculated</em>  TRUE indicates that the value of this field is
calculated. The value of calculated fields can by modified by 
subclassing QSqlCursor and overriding <a href="qsqlcursor.html#calculateField">QSqlCursor::calculateField</a>().
</ul>

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

<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 )
</h3>
Creates a QSqlFieldInfo object with the type and the name of the
<a href="qsqlfield.html">QSqlField</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="qsqlcursor.html">QSqlCursor</a>.

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

<h3 class=fn><a href="qvariant.html">QVariant</a> <a name="defaultValue"></a>QSqlFieldInfo::defaultValue () const
</h3>
Returns the default value of this field or an empty <a href="qvariant.html">QVariant</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 was not explicitly specified by the user.

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

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

<h3 class=fn>int <a name="isRequired"></a>QSqlFieldInfo::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>QSqlFieldInfo::isTrim () const
</h3>
Returns TRUE if trailing whitespace should be removed from character
fields.
<p> <p>See also <a href="#setTrim">setTrim</a>().

<h3 class=fn>int <a name="length"></a>QSqlFieldInfo::length () const
</h3>
Returns the length of this field. 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="qstring.html">QString</a> <a name="name"></a>QSqlFieldInfo::name () const
</h3> Returns the name of the field in the SQL table.

<p>Examples: <a href="sql.html#x2374">sql/overview/subclass3/main.cpp</a> and <a href="sql.html#x2378">sql/overview/subclass4/main.cpp</a>.
<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 )
</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>QSqlFieldInfo::operator== ( const&nbsp;<a href="qsqlfieldinfo.html">QSqlFieldInfo</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 when all their attributes match.

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

<h3 class=fn>void <a name="setCalculated"></a>QSqlFieldInfo::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="qsqlcursor.html">QSqlCursor</a> and overriding <a href="qsqlcursor.html#calculateField">QSqlCursor::calculateField</a>().
<p> <p>See also <a href="#isCalculated">isCalculated</a>().

<h3 class=fn>void <a name="setGenerated"></a>QSqlFieldInfo::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="qsqlcursor.html">QSqlCursor</a>).
<p> <p>See also <a href="#isGenerated">isGenerated</a>().

<h3 class=fn>void <a name="setTrim"></a>QSqlFieldInfo::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="qsqlfield.html">QSqlField</a> <a name="toField"></a>QSqlFieldInfo::toField () const
</h3>
Returns an empty <a href="qsqlfield.html">QSqlField</a> based on the information
in this QSqlFieldInfo.

<h3 class=fn><a href="qvariant.html#Type-enum">QVariant::Type</a> <a name="type"></a>QSqlFieldInfo::type () const
</h3> Returns the type of this field or QVariant::Invalid if the type is unknown.

<h3 class=fn>int <a name="typeID"></a>QSqlFieldInfo::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">Qt toolkit</a>.
Copyright &copy; 1995-2001
<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; 2001 
<a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt version 3.0.2</div>
</table></div></address></body>
</html>