diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-08 12:31:36 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-11-08 12:31:36 -0600 |
commit | d796c9dd933ab96ec83b9a634feedd5d32e1ba3f (patch) | |
tree | 6e3dcca4f77e20ec8966c666aac7c35bd4704053 /doc/html/qsqlfield.html | |
download | tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.tar.gz tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.zip |
Test conversion to TQt3 from Qt3 8c6fc1f8e35fd264dd01c582ca5e7549b32ab731
Diffstat (limited to 'doc/html/qsqlfield.html')
-rw-r--r-- | doc/html/qsqlfield.html | 216 |
1 files changed, 216 insertions, 0 deletions
diff --git a/doc/html/qsqlfield.html b/doc/html/qsqlfield.html new file mode 100644 index 000000000..fc2cdb2d5 --- /dev/null +++ b/doc/html/qsqlfield.html @@ -0,0 +1,216 @@ +<!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:42 --> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<title>TQSqlField 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>TQSqlField Class Reference<br><small>[<a href="sql.html">sql module</a>]</small></h1> + +<p>The TQSqlField class manipulates the fields in SQL database tables +and views. +<a href="#details">More...</a> +<p><tt>#include <<a href="qsqlfield-h.html">qsqlfield.h</a>></tt> +<p><a href="qsqlfield-members.html">List of all member functions.</a> +<h2>Public Members</h2> +<ul> +<li class=fn><a href="#TQSqlField"><b>TQSqlField</b></a> ( const TQString & fieldName = TQString::null, TQVariant::Type type = TQVariant::Invalid )</li> +<li class=fn><a href="#TQSqlField-2"><b>TQSqlField</b></a> ( const TQSqlField & other )</li> +<li class=fn>TQSqlField & <a href="#operator-eq"><b>operator=</b></a> ( const TQSqlField & other )</li> +<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const TQSqlField & other ) const</li> +<li class=fn>virtual <a href="#~TQSqlField"><b>~TQSqlField</b></a> ()</li> +<li class=fn>virtual void <a href="#setValue"><b>setValue</b></a> ( const TQVariant & value )</li> +<li class=fn>virtual TQVariant <a href="#value"><b>value</b></a> () const</li> +<li class=fn>virtual void <a href="#setName"><b>setName</b></a> ( const TQString & name )</li> +<li class=fn>TQString <a href="#name"><b>name</b></a> () const</li> +<li class=fn>virtual void <a href="#setNull"><b>setNull</b></a> ()</li> +<li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li> +<li class=fn>virtual void <a href="#setReadOnly"><b>setReadOnly</b></a> ( bool readOnly )</li> +<li class=fn>bool <a href="#isReadOnly"><b>isReadOnly</b></a> () const</li> +<li class=fn>void <a href="#clear"><b>clear</b></a> ( bool nullify = TRUE )</li> +<li class=fn>TQVariant::Type <a href="#type"><b>type</b></a> () const</li> +</ul> +<hr><a name="details"></a><h2>Detailed Description</h2> + + +The TQSqlField class manipulates the fields in SQL database tables +and views. +<p> + +<p> TQSqlField represents the characteristics of a single column in a +database table or view, such as the data type and column name. A +field also contains the value of the database column, which can be +viewed or changed. +<p> Field data values are stored as TQVariants. Using an incompatible +type is not permitted. For example: +<p> <pre> + TQSqlField f( "myfield", TQVariant::Int ); + f.<a href="#setValue">setValue</a>( TQPixmap() ); // will not work + </pre> + +<p> However, the field will attempt to cast certain data types to the +field data type where possible: +<p> <pre> + TQSqlField f( "myfield", TQVariant::Int ); + f.<a href="#setValue">setValue</a>( TQString("123") ); // casts TQString to int + </pre> + +<p> TQSqlField objects are rarely created explicitly in application +code. They are usually accessed indirectly through <a href="qsqlrecord.html">TQSqlRecord</a> +or <a href="qsqlcursor.html">TQSqlCursor</a> which already contain a list of fields. For +example: +<p> <pre> + <a href="qsqlcursor.html">TQSqlCursor</a> cur( "Employee" ); // create cursor using the 'Employee' table + TQSqlField* f = cur.<a href="qsqlrecord.html#field">field</a>( "name" ); // use the 'name' field + f-><a href="#setValue">setValue</a>( "Dave" ); // set field value + ... + </pre> + +<p> In practice we rarely need to extract a pointer to a field at all. +The previous example would normally be written: +<p> <pre> + <a href="qsqlcursor.html">TQSqlCursor</a> cur( "Employee" ); + cur.<a href="qsqlrecord.html#setValue">setValue</a>( "name", "Dave" ); + ... + </pre> + +<p>See also <a href="database.html">Database Classes</a>. + +<hr><h2>Member Function Documentation</h2> +<h3 class=fn><a name="TQSqlField"></a>TQSqlField::TQSqlField ( const <a href="qstring.html">TQString</a> & fieldName = TQString::null, <a href="qvariant.html#Type-enum">TQVariant::Type</a> type = TQVariant::Invalid ) +</h3> +Constructs an empty field called <em>fieldName</em> of type <em>type</em>. + +<h3 class=fn><a name="TQSqlField-2"></a>TQSqlField::TQSqlField ( const <a href="qsqlfield.html">TQSqlField</a> & other ) +</h3> +Constructs a copy of <em>other</em>. + +<h3 class=fn><a name="~TQSqlField"></a>TQSqlField::~TQSqlField ()<tt> [virtual]</tt> +</h3> +Destroys the object and frees any allocated resources. + +<h3 class=fn>void <a name="clear"></a>TQSqlField::clear ( bool nullify = TRUE ) +</h3> +Clears the value of the field. If the field is read-only, nothing +happens. If <em>nullify</em> is TRUE (the default), the field is set to +NULL. + +<h3 class=fn>bool <a name="isNull"></a>TQSqlField::isNull () const +</h3> + +<p> Returns TRUE if the field is currently NULL; otherwise returns +FALSE. + +<h3 class=fn>bool <a name="isReadOnly"></a>TQSqlField::isReadOnly () const +</h3> + +<p> Returns TRUE if the field's value is read only; otherwise returns +FALSE. + +<h3 class=fn><a href="qstring.html">TQString</a> <a name="name"></a>TQSqlField::name () const +</h3> + +<p> Returns the name of the field. + +<p>Example: <a href="sql.html#x2249">sql/overview/table4/main.cpp</a>. +<h3 class=fn><a href="qsqlfield.html">TQSqlField</a> & <a name="operator-eq"></a>TQSqlField::operator= ( const <a href="qsqlfield.html">TQSqlField</a> & other ) +</h3> +Sets the field equal to <em>other</em>. + +<h3 class=fn>bool <a name="operator-eq-eq"></a>TQSqlField::operator== ( const <a href="qsqlfield.html">TQSqlField</a> & other ) const +</h3> +Returns TRUE if the field is equal to <em>other</em>; otherwise returns +FALSE. Fields are considered equal when the following field +properties are the same: +<p> <ul> +<li> <a href="#name">name</a>() +<li> <a href="#isNull">isNull</a>() +<li> <a href="#value">value</a>() +<li> <a href="#isReadOnly">isReadOnly</a>() +</ul> +<p> +<h3 class=fn>void <a name="setName"></a>TQSqlField::setName ( const <a href="qstring.html">TQString</a> & name )<tt> [virtual]</tt> +</h3> + +<p> Sets the name of the field to <em>name</em>. + +<h3 class=fn>void <a name="setNull"></a>TQSqlField::setNull ()<tt> [virtual]</tt> +</h3> + +<p> Sets the field to NULL and clears the value using <a href="#clear">clear</a>(). If the +field is read-only, nothing happens. +<p> <p>See also <a href="#isReadOnly">isReadOnly</a>() and <a href="#clear">clear</a>(). + +<h3 class=fn>void <a name="setReadOnly"></a>TQSqlField::setReadOnly ( bool readOnly )<tt> [virtual]</tt> +</h3> + +<p> Sets the read only flag of the field's value to <em>readOnly</em>. +<p> <p>See also <a href="#setValue">setValue</a>(). + +<h3 class=fn>void <a name="setValue"></a>TQSqlField::setValue ( const <a href="qvariant.html">TQVariant</a> & value )<tt> [virtual]</tt> +</h3> +Sets the value of the field to <em>value</em>. If the field is read-only +(<a href="#isReadOnly">isReadOnly</a>() returns TRUE), nothing happens. If the data type of +<em>value</em> differs from the field's current data type, an attempt is +made to cast it to the proper type. This preserves the data type +of the field in the case of assignment, e.g. a <a href="qstring.html">TQString</a> to an +integer data type. For example: +<p> <pre> + <a href="qsqlcursor.html">TQSqlCursor</a> cur( "Employee" ); // 'Employee' table + TQSqlField* f = cur.<a href="qsqlrecord.html#field">field</a>( "student_count" ); // an integer field + ... + f-><a href="#setValue">setValue</a>( myLineEdit->text() ); // cast the line edit text to an integer + </pre> + +<p> <p>See also <a href="#isReadOnly">isReadOnly</a>(). + +<h3 class=fn><a href="qvariant.html#Type-enum">TQVariant::Type</a> <a name="type"></a>TQSqlField::type () const +</h3> + +<p> Returns the field's type as stored in the database. +Note that the actual value might have a different type, +Numerical values that are too large to store in a long +int or double are usually stored as strings to prevent +precision loss. + +<h3 class=fn><a href="qvariant.html">TQVariant</a> <a name="value"></a>TQSqlField::value () const<tt> [virtual]</tt> +</h3> + +<p> Returns the value of the field as a <a href="qvariant.html">TQVariant</a>. + +<p>Example: <a href="sql.html#x2250">sql/overview/table4/main.cpp</a>. +<!-- 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> |