1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Definition of QSqlResult class
|
---|
4 | **
|
---|
5 | ** Created : 2000-11-03
|
---|
6 | **
|
---|
7 | ** Copyright (C) 2005-2007 Trolltech ASA. All rights reserved.
|
---|
8 | **
|
---|
9 | ** This file is part of the sql module of the Qt GUI Toolkit.
|
---|
10 | **
|
---|
11 | ** This file may be distributed under the terms of the Q Public License
|
---|
12 | ** as defined by Trolltech ASA of Norway and appearing in the file
|
---|
13 | ** LICENSE.QPL included in the packaging of this file.
|
---|
14 | **
|
---|
15 | ** This file may be distributed and/or modified under the terms of the
|
---|
16 | ** GNU General Public License version 2 as published by the Free Software
|
---|
17 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
18 | ** packaging of this file.
|
---|
19 | **
|
---|
20 | ** Licensees holding valid Qt Enterprise Edition licenses may use this
|
---|
21 | ** file in accordance with the Qt Commercial License Agreement provided
|
---|
22 | ** with the Software.
|
---|
23 | **
|
---|
24 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
25 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
26 | **
|
---|
27 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
28 | ** information about Qt Commercial License Agreements.
|
---|
29 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
30 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
31 | **
|
---|
32 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
33 | ** not clear to you.
|
---|
34 | **
|
---|
35 | **********************************************************************/
|
---|
36 |
|
---|
37 | #ifndef QSQLRESULT_H
|
---|
38 | #define QSQLRESULT_H
|
---|
39 |
|
---|
40 | #ifndef QT_H
|
---|
41 | #include "qstring.h"
|
---|
42 | #include "qvariant.h"
|
---|
43 | #include "qsqlerror.h"
|
---|
44 | #include "qsqlfield.h"
|
---|
45 | #include "qsql.h"
|
---|
46 | #endif // QT_H
|
---|
47 |
|
---|
48 | #if !defined( QT_MODULE_SQL ) || defined( QT_LICENSE_PROFESSIONAL )
|
---|
49 | #define QM_EXPORT_SQL
|
---|
50 | #else
|
---|
51 | #define QM_EXPORT_SQL Q_EXPORT
|
---|
52 | #endif
|
---|
53 |
|
---|
54 | #ifndef QT_NO_SQL
|
---|
55 |
|
---|
56 | class QSqlDriver;
|
---|
57 | class QSql;
|
---|
58 | class QSqlResultPrivate;
|
---|
59 | class QSqlExtension;
|
---|
60 |
|
---|
61 | class QM_EXPORT_SQL QSqlResult
|
---|
62 | {
|
---|
63 | friend class QSqlQuery;
|
---|
64 | friend class QSqlResultShared;
|
---|
65 | public:
|
---|
66 | virtual ~QSqlResult();
|
---|
67 |
|
---|
68 | // BCI HACK - remove in 4.0
|
---|
69 | void setExtension( QSqlExtension * ext );
|
---|
70 | QSqlExtension * extension();
|
---|
71 |
|
---|
72 | protected:
|
---|
73 | QSqlResult(const QSqlDriver * db );
|
---|
74 | int at() const;
|
---|
75 | QString lastQuery() const;
|
---|
76 | QSqlError lastError() const;
|
---|
77 | bool isValid() const;
|
---|
78 | bool isActive() const;
|
---|
79 | bool isSelect() const;
|
---|
80 | bool isForwardOnly() const;
|
---|
81 | const QSqlDriver* driver() const;
|
---|
82 | virtual void setAt( int at );
|
---|
83 | virtual void setActive( bool a );
|
---|
84 | virtual void setLastError( const QSqlError& e );
|
---|
85 | virtual void setQuery( const QString& query );
|
---|
86 | virtual void setSelect( bool s );
|
---|
87 | virtual void setForwardOnly( bool forward );
|
---|
88 |
|
---|
89 | virtual QVariant data( int i ) = 0;
|
---|
90 | virtual bool isNull( int i ) = 0;
|
---|
91 | virtual bool reset ( const QString& sqlquery ) = 0;
|
---|
92 | virtual bool fetch( int i ) = 0;
|
---|
93 | virtual bool fetchNext();
|
---|
94 | virtual bool fetchPrev();
|
---|
95 | virtual bool fetchFirst() = 0;
|
---|
96 | virtual bool fetchLast() = 0;
|
---|
97 | virtual int size() = 0;
|
---|
98 | virtual int numRowsAffected() = 0;
|
---|
99 | private:
|
---|
100 | QSqlResultPrivate* d;
|
---|
101 | bool forwardOnly;
|
---|
102 |
|
---|
103 | private: // Disabled copy constructor and operator=
|
---|
104 | #if defined(Q_DISABLE_COPY)
|
---|
105 | QSqlResult( const QSqlResult & );
|
---|
106 | QSqlResult &operator=( const QSqlResult & );
|
---|
107 | #endif
|
---|
108 | };
|
---|
109 |
|
---|
110 | #endif // QT_NO_SQL
|
---|
111 | #endif
|
---|