1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Definition of shared Qt SQL module classes
|
---|
4 | **
|
---|
5 | ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
---|
6 | **
|
---|
7 | ** This file is part of the sql module of the Qt GUI Toolkit.
|
---|
8 | **
|
---|
9 | ** This file may be distributed under the terms of the Q Public License
|
---|
10 | ** as defined by Trolltech ASA of Norway and appearing in the file
|
---|
11 | ** LICENSE.QPL included in the packaging of this file.
|
---|
12 | **
|
---|
13 | ** This file may be distributed and/or modified under the terms of the
|
---|
14 | ** GNU General Public License version 2 as published by the Free Software
|
---|
15 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
16 | ** packaging of this file.
|
---|
17 | **
|
---|
18 | ** Licensees holding valid Qt Enterprise Edition licenses may use this
|
---|
19 | ** file in accordance with the Qt Commercial License Agreement provided
|
---|
20 | ** with the Software.
|
---|
21 | **
|
---|
22 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
23 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
24 | **
|
---|
25 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
26 | ** information about Qt Commercial License Agreements.
|
---|
27 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
28 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
29 | **
|
---|
30 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
31 | ** not clear to you.
|
---|
32 | **
|
---|
33 | **********************************************************************/
|
---|
34 |
|
---|
35 | #ifndef QSQLCACHEDRESULT_H
|
---|
36 | #define QSQLCACHEDRESULT_H
|
---|
37 |
|
---|
38 | //
|
---|
39 | // W A R N I N G
|
---|
40 | // -------------
|
---|
41 | //
|
---|
42 | // This file is not part of the Qt API. It exists for the convenience
|
---|
43 | // of other Qt classes. This header file may change from version to
|
---|
44 | // version without notice, or even be removed.
|
---|
45 | //
|
---|
46 | // We mean it.
|
---|
47 | //
|
---|
48 | //
|
---|
49 |
|
---|
50 | #include <qglobal.h>
|
---|
51 | #include <qvariant.h>
|
---|
52 | #include <qptrvector.h>
|
---|
53 | #include <qvaluevector.h>
|
---|
54 | #include <qsqlresult.h>
|
---|
55 |
|
---|
56 | #if !defined( QT_MODULE_SQL ) || defined( QT_LICENSE_PROFESSIONAL )
|
---|
57 | #define QM_EXPORT_SQL
|
---|
58 | #else
|
---|
59 | #define QM_EXPORT_SQL Q_EXPORT
|
---|
60 | #endif
|
---|
61 |
|
---|
62 | #ifndef QT_NO_SQL
|
---|
63 |
|
---|
64 | class QtSqlCachedResultPrivate;
|
---|
65 |
|
---|
66 | class QM_EXPORT_SQL QtSqlCachedResult: public QSqlResult
|
---|
67 | {
|
---|
68 | public:
|
---|
69 | virtual ~QtSqlCachedResult();
|
---|
70 |
|
---|
71 | typedef QValueVector<QVariant> RowCache;
|
---|
72 | typedef QPtrVector<RowCache> RowsetCache;
|
---|
73 |
|
---|
74 | protected:
|
---|
75 | QtSqlCachedResult(const QSqlDriver * db);
|
---|
76 |
|
---|
77 | void init(int colCount);
|
---|
78 | void cleanup();
|
---|
79 | bool cacheNext();
|
---|
80 |
|
---|
81 | virtual bool gotoNext(RowCache* row) = 0;
|
---|
82 |
|
---|
83 | QVariant data(int i);
|
---|
84 | bool isNull(int i);
|
---|
85 | bool fetch(int i);
|
---|
86 | bool fetchNext();
|
---|
87 | bool fetchPrev();
|
---|
88 | bool fetchFirst();
|
---|
89 | bool fetchLast();
|
---|
90 |
|
---|
91 | int colCount() const;
|
---|
92 |
|
---|
93 | private:
|
---|
94 | QtSqlCachedResultPrivate *d;
|
---|
95 | };
|
---|
96 |
|
---|
97 |
|
---|
98 | #endif
|
---|
99 |
|
---|
100 | #endif
|
---|