1QSqlFieldInfo(3qt) QSqlFieldInfo(3qt)
2
3
4
6 QSqlFieldInfo - Stores meta data associated with a SQL field
7
9 #include <qsqlfield.h>
10
11 Public Members
12 QSqlFieldInfo ( const QString & name = QString::null, QVariant::Type
13 typ = QVariant::Invalid, int required = -1, int len = -1, int prec
14 = -1, const QVariant & defValue = QVariant ( ), int typeID = 0,
15 bool generated = TRUE, bool trim = FALSE, bool calculated = FALSE )
16 QSqlFieldInfo ( const QSqlFieldInfo & other )
17 QSqlFieldInfo ( const QSqlField & other, bool generated = TRUE )
18 virtual ~QSqlFieldInfo ()
19 QSqlFieldInfo & operator= ( const QSqlFieldInfo & other )
20 bool operator== ( const QSqlFieldInfo & f ) const
21 QSqlField toField () const
22 int isRequired () const
23 QVariant::Type type () const
24 int length () const
25 int precision () const
26 QVariant defaultValue () const
27 QString name () const
28 int typeID () const
29 bool isGenerated () const
30 bool isTrim () const
31 bool isCalculated () const
32 virtual void setTrim ( bool trim )
33 virtual void setGenerated ( bool gen )
34 virtual void setCalculated ( bool calc )
35
37 The QSqlFieldInfo class stores meta data associated with a SQL field.
38
39 QSqlFieldInfo objects only store meta data; field values are stored in
40 QSqlField objects.
41
42 All values must be set in the constructor, and may be retrieved using
43 isRequired(), type(), length(), precision(), defaultValue(), name(),
44 isGenerated() and typeID().
45
46 See also Database Classes.
47
50 QVariant::Type typ = QVariant::Invalid, int required = -1, int len =
51 -1, int prec = -1, const QVariant & defValue = QVariant ( ), int typeID
52 = 0, bool generated = TRUE, bool trim = FALSE, bool calculated = FALSE
53 )
54 Constructs a QSqlFieldInfo with the following parameters: <center>.nf
55
56 </center>
57
59 Constructs a copy of other.
60
62 )
63 Creates a QSqlFieldInfo object with the type and the name of the
64 QSqlField other. If generated is TRUE this field will be included in
65 auto-generated SQL statments, e.g. in QSqlCursor.
66
68 Destroys the object and frees any allocated resources.
69
71 Returns the field's default value or an empty QVariant if the field has
72 no default value or the value couldn't be determined. The default value
73 is the value inserted in the database when it is not explicitly
74 specified by the user.
75
77 Returns TRUE if the field is calculated; otherwise returns FALSE.
78
79 See also setCalculated().
80
82 Returns TRUE if the field should be included in auto-generated SQL
83 statments, e.g. in QSqlCursor; otherwise returns FALSE.
84
85 See also setGenerated().
86
88 Returns a value greater than 0 if the field is required (NULL values
89 are not allowed), 0 if it isn't required (NULL values are allowed) or
90 less than 0 if it cannot be determined whether the field is required or
91 not.
92
94 Returns TRUE if trailing whitespace should be removed from character
95 fields; otherwise returns FALSE.
96
97 See also setTrim().
98
100 Returns the field's length. For fields storing text the return value is
101 the maximum number of characters the field can hold. For non-character
102 fields some database systems return the number of bytes needed or the
103 number of digits allowed. If the length cannot be determined -1 is
104 returned.
105
107 Returns the name of the field in the SQL table.
108
109 Examples:
110
112 Assigns other to this field info and returns a reference to it.
113
115 Returns TRUE if this fieldinfo is equal to f; otherwise returns FALSE.
116
117 Two field infos are considered equal if all their attributes match.
118
120 Returns the field's precision or -1 if the field has no precision or it
121 cannot be determined.
122
124 calc set to TRUE indicates that this field is a calculated field. The
125 value of calculated fields can by modified by subclassing QSqlCursor
126 and overriding QSqlCursor::calculateField().
127
128 See also isCalculated().
129
131 gen set to FALSE indicates that this field should not appear in auto-
132 generated SQL statements (for example in QSqlCursor).
133
134 See also isGenerated().
135
137 If trim is TRUE widgets should remove trailing whitespace from
138 character fields. This does not affect the field value but only its
139 representation inside widgets.
140
141 See also isTrim().
142
144 Returns an empty QSqlField based on the information in this
145 QSqlFieldInfo.
146
148 Returns the field's type or QVariant::Invalid if the type is unknown.
149
151 Returns the internal type identifier as returned from the database
152 system. The return value is 0 if the type is unknown.
153
154 Warning: This information is only useful for low-level database
155 programming and is not database independent.
156
157
159 http://doc.trolltech.com/qsqlfieldinfo.html
160 http://www.trolltech.com/faq/tech.html
161
163 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
164 license file included in the distribution for a complete license
165 statement.
166
168 Generated automatically from the source code.
169
171 If you find a bug in Qt, please report it as described in
172 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
173 help you. Thank you.
174
175 The definitive Qt documentation is provided in HTML format; it is
176 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
177 web browser. This man page is provided as a convenience for those users
178 who prefer man pages, although this format is not officially supported
179 by Trolltech.
180
181 If you find errors in this manual page, please report them to qt-
182 bugs@trolltech.com. Please include the name of the manual page
183 (qsqlfieldinfo.3qt) and the Qt version (3.3.8).
184
185
186
187Trolltech AS 2 February 2007 QSqlFieldInfo(3qt)