summaryrefslogtreecommitdiffstats
path: root/doc/man/man3/tqsqlrecord.3qt
blob: 3d66d000533eb5e29d062e3f15983fa3791567bd (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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
'\" t
.TH TQSqlRecord 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
TQSqlRecord \- Encapsulates a database record, i.e. a set of database fields
.SH SYNOPSIS
\fC#include <tqsqlrecord.h>\fR
.PP
Inherited by TQSqlCursor and TQSqlIndex.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBTQSqlRecord\fR ()"
.br
.ti -1c
.BI "\fBTQSqlRecord\fR ( const TQSqlRecord & other )"
.br
.ti -1c
.BI "TQSqlRecord & \fBoperator=\fR ( const TQSqlRecord & other )"
.br
.ti -1c
.BI "virtual \fB~TQSqlRecord\fR ()"
.br
.ti -1c
.BI "virtual QVariant \fBvalue\fR ( int i ) const"
.br
.ti -1c
.BI "virtual QVariant \fBvalue\fR ( const TQString & name ) const"
.br
.ti -1c
.BI "virtual void \fBsetValue\fR ( int i, const QVariant & val )"
.br
.ti -1c
.BI "virtual void \fBsetValue\fR ( const TQString & name, const QVariant & val )"
.br
.ti -1c
.BI "bool \fBisGenerated\fR ( int i ) const"
.br
.ti -1c
.BI "bool \fBisGenerated\fR ( const TQString & name ) const"
.br
.ti -1c
.BI "virtual void \fBsetGenerated\fR ( const TQString & name, bool generated )"
.br
.ti -1c
.BI "virtual void \fBsetGenerated\fR ( int i, bool generated )"
.br
.ti -1c
.BI "virtual void \fBsetNull\fR ( int i )"
.br
.ti -1c
.BI "virtual void \fBsetNull\fR ( const TQString & name )"
.br
.ti -1c
.BI "bool \fBisNull\fR ( int i ) const"
.br
.ti -1c
.BI "bool \fBisNull\fR ( const TQString & name ) const"
.br
.ti -1c
.BI "int \fBposition\fR ( const TQString & name ) const"
.br
.ti -1c
.BI "TQString \fBfieldName\fR ( int i ) const"
.br
.ti -1c
.BI "TQSqlField * \fBfield\fR ( int i )"
.br
.ti -1c
.BI "TQSqlField * \fBfield\fR ( const TQString & name )"
.br
.ti -1c
.BI "const TQSqlField * \fBfield\fR ( int i ) const"
.br
.ti -1c
.BI "const TQSqlField * \fBfield\fR ( const TQString & name ) const"
.br
.ti -1c
.BI "virtual void \fBappend\fR ( const TQSqlField & field )"
.br
.ti -1c
.BI "virtual void \fBinsert\fR ( int pos, const TQSqlField & field )"
.br
.ti -1c
.BI "virtual void \fBremove\fR ( int pos )"
.br
.ti -1c
.BI "bool \fBisEmpty\fR () const"
.br
.ti -1c
.BI "bool \fBcontains\fR ( const TQString & name ) const"
.br
.ti -1c
.BI "virtual void \fBclear\fR ()"
.br
.ti -1c
.BI "virtual void \fBclearValues\fR ( bool nullify = FALSE )"
.br
.ti -1c
.BI "uint \fBcount\fR () const"
.br
.ti -1c
.BI "virtual TQString \fBtoString\fR ( const TQString & prefix = TQString::null, const TQString & sep = "","" ) const"
.br
.ti -1c
.BI "virtual QStringList \fBtoStringList\fR ( const TQString & prefix = TQString::null ) const"
.br
.in -1c
.SH DESCRIPTION
The TQSqlRecord class encapsulates a database record, i.e. a set of database fields.
.PP
The TQSqlRecord class encapsulates the functionality and characteristics of a database record (usually a table or view within the database). TQSqlRecords support adding and removing fields as well as setting and retrieving field values.
.PP
TQSqlRecord is implicitly shared. This means you can make copies of the record in time O(1). If multiple TQSqlRecord instances share the same data and one is modifying the record's data then this modifying instance makes a copy and modifies its private copy - thus it does not affect other instances.
.PP
See also TQSqlRecordInfo and Database Classes.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "TQSqlRecord::TQSqlRecord ()"
Constructs an empty record.
.SH "TQSqlRecord::TQSqlRecord ( const TQSqlRecord & other )"
Constructs a copy of \fIother\fR.
.SH "TQSqlRecord::~TQSqlRecord ()\fC [virtual]\fR"
Destroys the object and frees any allocated resources.
.SH "void TQSqlRecord::append ( const TQSqlField & field )\fC [virtual]\fR"
Append a copy of field \fIfield\fR to the end of the record.
.PP
Reimplemented in TQSqlIndex.
.SH "void TQSqlRecord::clear ()\fC [virtual]\fR"
Removes all the record's fields.
.PP
See also clearValues().
.PP
Reimplemented in TQSqlCursor.
.SH "void TQSqlRecord::clearValues ( bool nullify = FALSE )\fC [virtual]\fR"
Clears the value of all fields in the record. If \fInullify\fR is TRUE, (the default is FALSE), each field is set to NULL.
.SH "bool TQSqlRecord::contains ( const TQString & name ) const"
Returns TRUE if there is a field in the record called \fIname\fR; otherwise returns FALSE.
.SH "uint TQSqlRecord::count () const"
Returns the number of fields in the record.
.SH "TQSqlField * TQSqlRecord::field ( int i )"
Returns the field at position \fIi\fR within the record, or 0 if it cannot be found.
.SH "TQSqlField * TQSqlRecord::field ( const TQString & name )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the field called \fIname\fR within the record, or 0 if it cannot be found. Field names are not case-sensitive.
.SH "const TQSqlField * TQSqlRecord::field ( int i ) const"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.SH "const TQSqlField * TQSqlRecord::field ( const TQString & name ) const"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the field called \fIname\fR within the record, or 0 if it cannot be found. Field names are not case-sensitive.
.SH "TQString TQSqlRecord::fieldName ( int i ) const"
Returns the name of the field at position \fIi\fR. If the field does not exist, TQString::null is returned.
.SH "void TQSqlRecord::insert ( int pos, const TQSqlField & field )\fC [virtual]\fR"
Insert a copy of \fIfield\fR at position \fIpos\fR. If a field already exists at \fIpos\fR, it is removed.
.SH "bool TQSqlRecord::isEmpty () const"
Returns TRUE if there are no fields in the record; otherwise returns FALSE.
.SH "bool TQSqlRecord::isGenerated ( const TQString & name ) const"
Returns TRUE if the record has a field called \fIname\fR and this field is to be generated (the default); otherwise returns FALSE.
.PP
See also setGenerated().
.SH "bool TQSqlRecord::isGenerated ( int i ) const"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if the record has a field at position \fIi\fR and this field is to be generated (the default); otherwise returns FALSE.
.PP
See also setGenerated().
.SH "bool TQSqlRecord::isNull ( const TQString & name ) const"
Returns TRUE if the field called \fIname\fR is NULL or if there is no field called \fIname\fR; otherwise returns FALSE.
.PP
See also position().
.SH "bool TQSqlRecord::isNull ( int i ) const"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if the field \fIi\fR is NULL or if there is no field at position \fIi\fR; otherwise returns FALSE.
.PP
See also fieldName().
.SH "TQSqlRecord & TQSqlRecord::operator= ( const TQSqlRecord & other )"
Sets the record equal to \fIother\fR.
.SH "int TQSqlRecord::position ( const TQString & name ) const"
Returns the position of the field called \fIname\fR within the record, or -1 if it cannot be found. Field names are not case-sensitive. If more than one field matches, the first one is returned.
.SH "void TQSqlRecord::remove ( int pos )\fC [virtual]\fR"
Removes the field at \fIpos\fR. If \fIpos\fR does not exist, nothing happens.
.PP
Reimplemented in TQSqlCursor.
.SH "void TQSqlRecord::setGenerated ( const TQString & name, bool generated )\fC [virtual]\fR"
Sets the generated flag for the field called \fIname\fR to \fIgenerated\fR. If the field does not exist, nothing happens. Only fields that have \fIgenerated\fR set to TRUE are included in the SQL that is generated, e.g. by TQSqlCursor.
.PP
See also isGenerated().
.PP
Reimplemented in TQSqlCursor.
.SH "void TQSqlRecord::setGenerated ( int i, bool generated )\fC [virtual]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Sets the generated flag for the field \fIi\fR to \fIgenerated\fR.
.PP
See also isGenerated().
.PP
Reimplemented in TQSqlCursor.
.SH "void TQSqlRecord::setNull ( int i )\fC [virtual]\fR"
Sets the value of field \fIi\fR to NULL. If the field does not exist, nothing happens.
.SH "void TQSqlRecord::setNull ( const TQString & name )\fC [virtual]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Sets the value of the field called \fIname\fR to NULL. If the field does not exist, nothing happens.
.SH "void TQSqlRecord::setValue ( int i, const QVariant & val )\fC [virtual]\fR"
Sets the value of the field at position \fIi\fR to \fIval\fR. If the field does not exist, nothing happens.
.PP
Examples:
.)l sql/overview/insert/main.cpp, sql/overview/insert2/main.cpp, sql/overview/subclass5/main.cpp, sql/overview/update/main.cpp, and sql/sqltable/main.cpp.
.SH "void TQSqlRecord::setValue ( const TQString & name, const QVariant & val )\fC [virtual]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Sets the value of the field called \fIname\fR to \fIval\fR. If the field does not exist, nothing happens.
.SH "TQString TQSqlRecord::toString ( const TQString & prefix = TQString::null, const TQString & sep = "," ) const\fC [virtual]\fR"
Returns a list of all the record's field names as a string separated by \fIsep\fR.
.PP
Note that fields which are not generated are \fInot\fR included (see isGenerated()). The returned string is suitable, for example, for generating SQL SELECT statements. If a \fIprefix\fR is specified, e.g. a table name, all fields are prefixed in the form:
.PP"
\fIprefix\fR.<fieldname>"
.SH "QStringList TQSqlRecord::toStringList ( const TQString & prefix = TQString::null ) const\fC [virtual]\fR"
Returns a list of all the record's field names, each having the prefix \fIprefix\fR.
.PP
Note that fields which have generated set to FALSE are \fInot\fR included. (See isGenerated()). If \fIprefix\fR is supplied, e.g. a table name, all fields are prefixed in the form:
.PP"
\fIprefix\fR.<fieldname>"
.SH "QVariant TQSqlRecord::value ( int i ) const\fC [virtual]\fR"
Returns the value of the field located at position \fIi\fR in the record. If field \fIi\fR does not exist the resultant behaviour is undefined.
.PP
This function should be used with TQSqlQuerys. When working with a TQSqlCursor the value(const TQString&) overload which uses field names is more appropriate.
.PP
Example: sql/overview/update/main.cpp.
.SH "QVariant TQSqlRecord::value ( const TQString & name ) const\fC [virtual]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns the value of the field called \fIname\fR in the record. If
field \fIname\fR does not exist the resultant behaviour is undefined.

.SH "SEE ALSO"
.BR http://doc.trolltech.com/tqsqlrecord.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 qt-bugs@trolltech.com .
Please include the name of the manual page (tqsqlrecord.3qt) and the Qt
version (3.3.8).