1QSqlRecord(3qt)                                                QSqlRecord(3qt)
2
3
4

NAME

6       QSqlRecord - Encapsulates a database record, i.e. a set of database
7       fields
8

SYNOPSIS

10       #include <qsqlrecord.h>
11
12       Inherited by QSqlCursor and QSqlIndex.
13
14   Public Members
15       QSqlRecord ()
16       QSqlRecord ( const QSqlRecord & other )
17       QSqlRecord & operator= ( const QSqlRecord & other )
18       virtual ~QSqlRecord ()
19       virtual QVariant value ( int i ) const
20       virtual QVariant value ( const QString & name ) const
21       virtual void setValue ( int i, const QVariant & val )
22       virtual void setValue ( const QString & name, const QVariant & val )
23       bool isGenerated ( int i ) const
24       bool isGenerated ( const QString & name ) const
25       virtual void setGenerated ( const QString & name, bool generated )
26       virtual void setGenerated ( int i, bool generated )
27       virtual void setNull ( int i )
28       virtual void setNull ( const QString & name )
29       bool isNull ( int i ) const
30       bool isNull ( const QString & name ) const
31       int position ( const QString & name ) const
32       QString fieldName ( int i ) const
33       QSqlField * field ( int i )
34       QSqlField * field ( const QString & name )
35       const QSqlField * field ( int i ) const
36       const QSqlField * field ( const QString & name ) const
37       virtual void append ( const QSqlField & field )
38       virtual void insert ( int pos, const QSqlField & field )
39       virtual void remove ( int pos )
40       bool isEmpty () const
41       bool contains ( const QString & name ) const
42       virtual void clear ()
43       virtual void clearValues ( bool nullify = FALSE )
44       uint count () const
45       virtual QString toString ( const QString & prefix = QString::null,
46           const QString & sep = "," ) const
47       virtual QStringList toStringList ( const QString & prefix =
48           QString::null ) const
49

DESCRIPTION

51       The QSqlRecord class encapsulates a database record, i.e. a set of
52       database fields.
53
54       The QSqlRecord class encapsulates the functionality and characteristics
55       of a database record (usually a table or view within the database).
56       QSqlRecords support adding and removing fields as well as setting and
57       retrieving field values.
58
59       QSqlRecord is implicitly shared. This means you can make copies of the
60       record in time O(1). If multiple QSqlRecord instances share the same
61       data and one is modifying the record's data then this modifying
62       instance makes a copy and modifies its private copy - thus it does not
63       affect other instances.
64
65       See also QSqlRecordInfo and Database Classes.
66

MEMBER FUNCTION DOCUMENTATION

QSqlRecord::QSqlRecord ()

69       Constructs an empty record.
70

QSqlRecord::QSqlRecord ( const QSqlRecord & other )

72       Constructs a copy of other.
73

QSqlRecord::~QSqlRecord () [virtual]

75       Destroys the object and frees any allocated resources.
76

void QSqlRecord::append ( const QSqlField & field ) [virtual]

78       Append a copy of field field to the end of the record.
79
80       Reimplemented in QSqlIndex.
81

void QSqlRecord::clear () [virtual]

83       Removes all the record's fields.
84
85       See also clearValues().
86
87       Reimplemented in QSqlCursor.
88

void QSqlRecord::clearValues ( bool nullify = FALSE ) [virtual]

90       Clears the value of all fields in the record. If nullify is TRUE, (the
91       default is FALSE), each field is set to NULL.
92

bool QSqlRecord::contains ( const QString & name ) const

94       Returns TRUE if there is a field in the record called name; otherwise
95       returns FALSE.
96

uint QSqlRecord::count () const

98       Returns the number of fields in the record.
99

QSqlField * QSqlRecord::field ( int i )

101       Returns the field at position i within the record, or 0 if it cannot be
102       found.
103

QSqlField * QSqlRecord::field ( const QString & name )

105       This is an overloaded member function, provided for convenience. It
106       behaves essentially like the above function.
107
108       Returns the field called name within the record, or 0 if it cannot be
109       found. Field names are not case-sensitive.
110

const QSqlField * QSqlRecord::field ( int i ) const

112       This is an overloaded member function, provided for convenience. It
113       behaves essentially like the above function.
114

const QSqlField * QSqlRecord::field ( const QString & name ) const

116       This is an overloaded member function, provided for convenience. It
117       behaves essentially like the above function.
118
119       Returns the field called name within the record, or 0 if it cannot be
120       found. Field names are not case-sensitive.
121

QString QSqlRecord::fieldName ( int i ) const

123       Returns the name of the field at position i. If the field does not
124       exist, QString::null is returned.
125

void QSqlRecord::insert ( int pos, const QSqlField & field ) [virtual]

127       Insert a copy of field at position pos. If a field already exists at
128       pos, it is removed.
129

bool QSqlRecord::isEmpty () const

131       Returns TRUE if there are no fields in the record; otherwise returns
132       FALSE.
133

bool QSqlRecord::isGenerated ( const QString & name ) const

135       Returns TRUE if the record has a field called name and this field is to
136       be generated (the default); otherwise returns FALSE.
137
138       See also setGenerated().
139

bool QSqlRecord::isGenerated ( int i ) const

141       This is an overloaded member function, provided for convenience. It
142       behaves essentially like the above function.
143
144       Returns TRUE if the record has a field at position i and this field is
145       to be generated (the default); otherwise returns FALSE.
146
147       See also setGenerated().
148

bool QSqlRecord::isNull ( const QString & name ) const

150       Returns TRUE if the field called name is NULL or if there is no field
151       called name; otherwise returns FALSE.
152
153       See also position().
154

bool QSqlRecord::isNull ( int i ) const

156       This is an overloaded member function, provided for convenience. It
157       behaves essentially like the above function.
158
159       Returns TRUE if the field i is NULL or if there is no field at position
160       i; otherwise returns FALSE.
161
162       See also fieldName().
163

QSqlRecord & QSqlRecord::operator= ( const QSqlRecord & other )

165       Sets the record equal to other.
166

int QSqlRecord::position ( const QString & name ) const

168       Returns the position of the field called name within the record, or -1
169       if it cannot be found. Field names are not case-sensitive. If more than
170       one field matches, the first one is returned.
171

void QSqlRecord::remove ( int pos ) [virtual]

173       Removes the field at pos. If pos does not exist, nothing happens.
174
175       Reimplemented in QSqlCursor.
176

void QSqlRecord::setGenerated ( const QString & name, bool generated )

178       [virtual]
179       Sets the generated flag for the field called name to generated. If the
180       field does not exist, nothing happens. Only fields that have generated
181       set to TRUE are included in the SQL that is generated, e.g. by
182       QSqlCursor.
183
184       See also isGenerated().
185
186       Reimplemented in QSqlCursor.
187

void QSqlRecord::setGenerated ( int i, bool generated ) [virtual]

189       This is an overloaded member function, provided for convenience. It
190       behaves essentially like the above function.
191
192       Sets the generated flag for the field i to generated.
193
194       See also isGenerated().
195
196       Reimplemented in QSqlCursor.
197

void QSqlRecord::setNull ( int i ) [virtual]

199       Sets the value of field i to NULL. If the field does not exist, nothing
200       happens.
201

void QSqlRecord::setNull ( const QString & name ) [virtual]

203       This is an overloaded member function, provided for convenience. It
204       behaves essentially like the above function.
205
206       Sets the value of the field called name to NULL. If the field does not
207       exist, nothing happens.
208

void QSqlRecord::setValue ( int i, const QVariant & val ) [virtual]

210       Sets the value of the field at position i to val. If the field does not
211       exist, nothing happens.
212
213       Examples:
214

void QSqlRecord::setValue ( const QString & name, const QVariant & val )

216       [virtual]
217       This is an overloaded member function, provided for convenience. It
218       behaves essentially like the above function.
219
220       Sets the value of the field called name to val. If the field does not
221       exist, nothing happens.
222

QString QSqlRecord::toString ( const QString & prefix = QString::null, const

224       QString & sep =  ," ) const [virtual]"
225       Returns a list of all the record's field names as a string separated by
226       sep.
227
228       Note that fields which are not generated are not included (see
229       isGenerated()). The returned string is suitable, for example, for
230       generating SQL SELECT statements. If a prefix is specified, e.g. a
231       table name, all fields are prefixed in the form: prefix.<fieldname>"
232

QStringList QSqlRecord::toStringList ( const QString & prefix = QString::null

234       ) const [virtual]
235       Returns a list of all the record's field names, each having the prefix
236       prefix.
237
238       Note that fields which have generated set to FALSE are not included.
239       (See isGenerated()). If prefix is supplied, e.g. a table name, all
240       fields are prefixed in the form: prefix.<fieldname>"
241

QVariant QSqlRecord::value ( int i ) const [virtual]

243       Returns the value of the field located at position i in the record. If
244       field i does not exist the resultant behaviour is undefined.
245
246       This function should be used with QSqlQuerys. When working with a
247       QSqlCursor the value(const QString&) overload which uses field names is
248       more appropriate.
249
250       Example: sql/overview/update/main.cpp.
251

QVariant QSqlRecord::value ( const QString & name ) const [virtual]

253       This is an overloaded member function, provided for convenience. It
254       behaves essentially like the above function.
255
256       Returns the value of the field called name in the record. If field name
257       does not exist the resultant behaviour is undefined.
258
259

SEE ALSO

261       http://doc.trolltech.com/qsqlrecord.html
262       http://www.trolltech.com/faq/tech.html
263
265       Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
266       license file included in the distribution for a complete license
267       statement.
268

AUTHOR

270       Generated automatically from the source code.
271

BUGS

273       If you find a bug in Qt, please report it as described in
274       http://doc.trolltech.com/bughowto.html.  Good bug reports help us to
275       help you. Thank you.
276
277       The definitive Qt documentation is provided in HTML format; it is
278       located at $QTDIR/doc/html and can be read using Qt Assistant or with a
279       web browser. This man page is provided as a convenience for those users
280       who prefer man pages, although this format is not officially supported
281       by Trolltech.
282
283       If you find errors in this manual page, please report them to qt-
284       bugs@trolltech.com.  Please include the name of the manual page
285       (qsqlrecord.3qt) and the Qt version (3.3.8).
286
287
288
289Trolltech AS                    2 February 2007                QSqlRecord(3qt)
Impressum