1QSqlResult(3qt) QSqlResult(3qt)
2
3
4
6 QSqlResult - Abstract interface for accessing data from SQL databases
7
9 #include <qsqlresult.h>
10
11 Public Members
12 virtual ~QSqlResult ()
13
14 Protected Members
15 QSqlResult ( const QSqlDriver * db )
16 int at () const
17 QString lastQuery () const
18 QSqlError lastError () const
19 bool isValid () const
20 bool isActive () const
21 bool isSelect () const
22 bool isForwardOnly () const
23 const QSqlDriver * driver () const
24 virtual void setAt ( int at )
25 virtual void setActive ( bool a )
26 virtual void setLastError ( const QSqlError & e )
27 virtual void setQuery ( const QString & query )
28 virtual void setSelect ( bool s )
29 virtual void setForwardOnly ( bool forward )
30 virtual QVariant data ( int i ) = 0
31 virtual bool isNull ( int i ) = 0
32 virtual bool reset ( const QString & query ) = 0
33 virtual bool fetch ( int i ) = 0
34 virtual bool fetchNext ()
35 virtual bool fetchPrev ()
36 virtual bool fetchFirst () = 0
37 virtual bool fetchLast () = 0
38 virtual int size () = 0
39 virtual int numRowsAffected () = 0
40
42 The QSqlResult class provides an abstract interface for accessing data
43 from SQL databases.
44
45 Normally you would use QSqlQuery instead of QSqlResult since QSqlQuery
46 provides a generic wrapper for database-specific implementations of
47 QSqlResult.
48
49 See also QSql and Database Classes.
50
53 Protected constructor which creates a QSqlResult using database db. The
54 object is initialized to an inactive state.
55
57 Destroys the object and frees any allocated resources.
58
60 Returns the current (zero-based) position of the result.
61
63 Returns the data for field i (zero-based) as a QVariant. This function
64 is only called if the result is in an active state and is positioned on
65 a valid record and i is non-negative. Derived classes must reimplement
66 this function and return the value of field i, or QVariant() if it
67 cannot be determined.
68
70 Returns the driver associated with the result.
71
73 Positions the result to an arbitrary (zero-based) index i. This
74 function is only called if the result is in an active state. Derived
75 classes must reimplement this function and position the result to the
76 index i, and call setAt() with an appropriate value. Return TRUE to
77 indicate success, or FALSE to signify failure.
78
80 Positions the result to the first record in the result. This function
81 is only called if the result is in an active state. Derived classes
82 must reimplement this function and position the result to the first
83 record, and call setAt() with an appropriate value. Return TRUE to
84 indicate success, or FALSE to signify failure.
85
87 Positions the result to the last record in the result. This function is
88 only called if the result is in an active state. Derived classes must
89 reimplement this function and position the result to the last record,
90 and call setAt() with an appropriate value. Return TRUE to indicate
91 success, or FALSE to signify failure.
92
94 Positions the result to the next available record in the result. This
95 function is only called if the result is in an active state. The
96 default implementation calls fetch() with the next index. Derived
97 classes can reimplement this function and position the result to the
98 next record in some other way, and call setAt() with an appropriate
99 value. Return TRUE to indicate success, or FALSE to signify failure.
100
102 Positions the result to the previous available record in the result.
103 This function is only called if the result is in an active state. The
104 default implementation calls fetch() with the previous index. Derived
105 classes can reimplement this function and position the result to the
106 next record in some other way, and call setAt() with an appropriate
107 value. Return TRUE to indicate success, or FALSE to signify failure.
108
110 Returns TRUE if the result has records to be retrieved; otherwise
111 returns FALSE.
112
114 Returns TRUE if you can only scroll forward through a result set;
115 otherwise returns FALSE.
116
118 Returns TRUE if the field at position i is NULL; otherwise returns
119 FALSE.
120
122 Returns TRUE if the current result is from a SELECT statement;
123 otherwise returns FALSE.
124
126 Returns TRUE if the result is positioned on a valid record (that is,
127 the result is not positioned before the first or after the last
128 record); otherwise returns FALSE.
129
131 Returns the last error associated with the result.
132
134 Returns the current SQL query text, or QString::null if there is none.
135
137 Returns the number of rows affected by the last query executed.
138
140 Sets the result to use the SQL statement query for subsequent data
141 retrieval. Derived classes must reimplement this function and apply the
142 query to the database. This function is called only after the result is
143 set to an inactive state and is positioned before the first record of
144 the new result. Derived classes should return TRUE if the query was
145 successful and ready to be used, or FALSE otherwise.
146
148 Protected function provided for derived classes to set the internal
149 active state to the value of a.
150
151 See also isActive().
152
154 Protected function provided for derived classes to set the internal
155 (zero-based) result index to at.
156
157 See also at().
158
160 Sets forward only mode to forward. If forward is TRUE only fetchNext()
161 is allowed for navigating the results. Forward only mode needs far less
162 memory since results do not have to be cached. forward only mode is off
163 by default.
164
165 See also fetchNext().
166
168 Protected function provided for derived classes to set the last error
169 to the value of e.
170
171 See also lastError().
172
174 Sets the current query for the result to query. The result must be
175 reset() in order to execute the query on the database.
176
178 Protected function provided for derived classes to indicate whether or
179 not the current statement is a SQL SELECT statement. The s parameter
180 should be TRUE if the statement is a SELECT statement, or FALSE
181 otherwise.
182
184 Returns the size of the result or -1 if it cannot be determined.
185
186
188 http://doc.trolltech.com/qsqlresult.html
189 http://www.trolltech.com/faq/tech.html
190
192 Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
193 license file included in the distribution for a complete license
194 statement.
195
197 Generated automatically from the source code.
198
200 If you find a bug in Qt, please report it as described in
201 http://doc.trolltech.com/bughowto.html. Good bug reports help us to
202 help you. Thank you.
203
204 The definitive Qt documentation is provided in HTML format; it is
205 located at $QTDIR/doc/html and can be read using Qt Assistant or with a
206 web browser. This man page is provided as a convenience for those users
207 who prefer man pages, although this format is not officially supported
208 by Trolltech.
209
210 If you find errors in this manual page, please report them to qt-
211 bugs@trolltech.com. Please include the name of the manual page
212 (qsqlresult.3qt) and the Qt version (3.3.8).
213
214
215
216Trolltech AS 2 February 2007 QSqlResult(3qt)