summaryrefslogtreecommitdiffstats
path: root/doc/man/man3/tqsqlfieldinfo.3qt
blob: 755ffb2fb883507738f781cafd39ece0f1457ea6 (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
'\" t
.TH TQSqlFieldInfo 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA.  All rights reserved.  See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
TQSqlFieldInfo \- Stores meta data associated with a SQL field
.SH SYNOPSIS
\fC#include <tqsqlfield.h>\fR
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBTQSqlFieldInfo\fR ( 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 )"
.br
.ti -1c
.BI "\fBTQSqlFieldInfo\fR ( const TQSqlFieldInfo & other )"
.br
.ti -1c
.BI "\fBTQSqlFieldInfo\fR ( const TQSqlField & other, bool generated = TRUE )"
.br
.ti -1c
.BI "virtual \fB~TQSqlFieldInfo\fR ()"
.br
.ti -1c
.BI "TQSqlFieldInfo & \fBoperator=\fR ( const TQSqlFieldInfo & other )"
.br
.ti -1c
.BI "bool \fBoperator==\fR ( const TQSqlFieldInfo & f ) const"
.br
.ti -1c
.BI "TQSqlField \fBtoField\fR () const"
.br
.ti -1c
.BI "int \fBisRequired\fR () const"
.br
.ti -1c
.BI "TQVariant::Type \fBtype\fR () const"
.br
.ti -1c
.BI "int \fBlength\fR () const"
.br
.ti -1c
.BI "int \fBprecision\fR () const"
.br
.ti -1c
.BI "TQVariant \fBdefaultValue\fR () const"
.br
.ti -1c
.BI "TQString \fBname\fR () const"
.br
.ti -1c
.BI "int \fBtypeID\fR () const"
.br
.ti -1c
.BI "bool \fBisGenerated\fR () const"
.br
.ti -1c
.BI "bool \fBisTrim\fR () const"
.br
.ti -1c
.BI "bool \fBisCalculated\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetTrim\fR ( bool trim )"
.br
.ti -1c
.BI "virtual void \fBsetGenerated\fR ( bool gen )"
.br
.ti -1c
.BI "virtual void \fBsetCalculated\fR ( bool calc )"
.br
.in -1c
.SH DESCRIPTION
The TQSqlFieldInfo class stores meta data associated with a SQL field.
.PP
TQSqlFieldInfo objects only store meta data; field values are stored in TQSqlField objects.
.PP
All values must be set in the constructor, and may be retrieved using isRequired(), type(), length(), precision(), defaultValue(), name(), isGenerated() and typeID().
.PP
See also Database Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "TQSqlFieldInfo::TQSqlFieldInfo ( 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 )"
Constructs a TQSqlFieldInfo with the following parameters: <center>.nf
.TS
l - l. \fIname\fR the name of the field. \fItyp\fR the field's type in a TQVariant. \fIrequired\fR 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. \fIlen\fR 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. \fIprec\fR the precision of the field, or -1 if the field has no precision or it cannot be determined. \fIdefValue\fR 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. \fItypeID\fR the internal typeID of the database system (only useful for low-level programming). 0 if unknown. \fIgenerated\fR TRUE indicates that this field should be included in auto-generated SQL statments, e.g. in TQSqlCursor. \fItrim\fR TRUE indicates that widgets should remove trailing whitespace from character fields. This does not affect the field value but only its representation inside widgets. \fIcalculated\fR
.TE
.fi
</center>
.SH "TQSqlFieldInfo::TQSqlFieldInfo ( const TQSqlFieldInfo & other )"
Constructs a copy of \fIother\fR.
.SH "TQSqlFieldInfo::TQSqlFieldInfo ( const TQSqlField & other, bool generated = TRUE )"
Creates a TQSqlFieldInfo object with the type and the name of the TQSqlField \fIother\fR. If \fIgenerated\fR is TRUE this field will be included in auto-generated SQL statments, e.g. in TQSqlCursor.
.SH "TQSqlFieldInfo::~TQSqlFieldInfo ()\fC [virtual]\fR"
Destroys the object and frees any allocated resources.
.SH "TQVariant TQSqlFieldInfo::defaultValue () const"
Returns the field's default value or an empty TQVariant 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.
.SH "bool TQSqlFieldInfo::isCalculated () const"
Returns TRUE if the field is calculated; otherwise returns FALSE.
.PP
See also setCalculated().
.SH "bool TQSqlFieldInfo::isGenerated () const"
Returns TRUE if the field should be included in auto-generated SQL statments, e.g. in TQSqlCursor; otherwise returns FALSE.
.PP
See also setGenerated().
.SH "int TQSqlFieldInfo::isRequired () const"
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.
.SH "bool TQSqlFieldInfo::isTrim () const"
Returns TRUE if trailing whitespace should be removed from character fields; otherwise returns FALSE.
.PP
See also setTrim().
.SH "int TQSqlFieldInfo::length () const"
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.
.SH "TQString TQSqlFieldInfo::name () const"
Returns the name of the field in the SQL table.
.PP
Examples:
.)l sql/overview/subclass3/main.cpp and sql/overview/subclass4/main.cpp.
.SH "TQSqlFieldInfo & TQSqlFieldInfo::operator= ( const TQSqlFieldInfo & other )"
Assigns \fIother\fR to this field info and returns a reference to it.
.SH "bool TQSqlFieldInfo::operator== ( const TQSqlFieldInfo & f ) const"
Returns TRUE if this fieldinfo is equal to \fIf\fR; otherwise returns FALSE.
.PP
Two field infos are considered equal if all their attributes match.
.SH "int TQSqlFieldInfo::precision () const"
Returns the field's precision or -1 if the field has no precision or it cannot be determined.
.SH "void TQSqlFieldInfo::setCalculated ( bool calc )\fC [virtual]\fR"
\fIcalc\fR set to TRUE indicates that this field is a calculated field. The value of calculated fields can by modified by subclassing TQSqlCursor and overriding TQSqlCursor::calculateField().
.PP
See also isCalculated().
.SH "void TQSqlFieldInfo::setGenerated ( bool gen )\fC [virtual]\fR"
\fIgen\fR set to FALSE indicates that this field should not appear in auto-generated SQL statements (for example in TQSqlCursor).
.PP
See also isGenerated().
.SH "void TQSqlFieldInfo::setTrim ( bool trim )\fC [virtual]\fR"
If \fItrim\fR is TRUE widgets should remove trailing whitespace from character fields. This does not affect the field value but only its representation inside widgets.
.PP
See also isTrim().
.SH "TQSqlField TQSqlFieldInfo::toField () const"
Returns an empty TQSqlField based on the information in this TQSqlFieldInfo.
.SH "TQVariant::Type TQSqlFieldInfo::type () const"
Returns the field's type or TQVariant::Invalid if the type is unknown.
.SH "int TQSqlFieldInfo::typeID () const"
Returns the internal type identifier as returned from the database system. The return value is 0 if the type is unknown.
.PP
\fBWarning:\fR This information is only useful for low-level database
programming and is \fInot\fR database independent.

.SH "SEE ALSO"
.BR http://doc.trolltech.com/tqsqlfieldinfo.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech. 
.P
If you find errors in this manual page, please report them to
.BR [email protected] .
Please include the name of the manual page (tqsqlfieldinfo.3qt) and the Qt
version (3.3.8).