1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Definition of Interbase driver classes
|
---|
4 | **
|
---|
5 | ** Created : 030911
|
---|
6 | **
|
---|
7 | ** Copyright (C) 1992-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 QSQL_IBASE_H
|
---|
38 | #define QSQL_IBASE_H
|
---|
39 |
|
---|
40 | #include "qsqlresult.h"
|
---|
41 | #include "qsqldriver.h"
|
---|
42 | #include "../cache/qsqlcachedresult.h"
|
---|
43 |
|
---|
44 |
|
---|
45 | class QIBaseDriverPrivate;
|
---|
46 | class QIBaseResultPrivate;
|
---|
47 | class QIBaseDriver;
|
---|
48 |
|
---|
49 | class QIBaseResult : public QtSqlCachedResult
|
---|
50 | {
|
---|
51 | friend class QIBaseDriver;
|
---|
52 | friend class QIBaseResultPrivate;
|
---|
53 |
|
---|
54 | public:
|
---|
55 | QIBaseResult(const QIBaseDriver* db);
|
---|
56 | virtual ~QIBaseResult();
|
---|
57 |
|
---|
58 | bool prepare(const QString& query);
|
---|
59 | bool exec();
|
---|
60 |
|
---|
61 | protected:
|
---|
62 | bool gotoNext(QtSqlCachedResult::RowCache* row);
|
---|
63 | bool reset (const QString& query);
|
---|
64 | int size();
|
---|
65 | int numRowsAffected();
|
---|
66 |
|
---|
67 | private:
|
---|
68 | QIBaseResultPrivate* d;
|
---|
69 | };
|
---|
70 |
|
---|
71 | class QIBaseDriver : public QSqlDriver
|
---|
72 | {
|
---|
73 | friend class QIBaseDriverPrivate;
|
---|
74 | friend class QIBaseResultPrivate;
|
---|
75 | friend class QIBaseResult;
|
---|
76 | public:
|
---|
77 | QIBaseDriver(QObject *parent = 0, const char *name = 0);
|
---|
78 | QIBaseDriver(void *connection, QObject *parent = 0, const char *name = 0);
|
---|
79 | virtual ~QIBaseDriver();
|
---|
80 | bool hasFeature(DriverFeature f) const;
|
---|
81 | bool open(const QString & db,
|
---|
82 | const QString & user,
|
---|
83 | const QString & password,
|
---|
84 | const QString & host,
|
---|
85 | int port,
|
---|
86 | const QString & connOpts);
|
---|
87 | bool open( const QString & db,
|
---|
88 | const QString & user,
|
---|
89 | const QString & password,
|
---|
90 | const QString & host,
|
---|
91 | int port ) { return open (db, user, password, host, port, QString()); }
|
---|
92 | void close();
|
---|
93 | QSqlQuery createQuery() const;
|
---|
94 | bool beginTransaction();
|
---|
95 | bool commitTransaction();
|
---|
96 | bool rollbackTransaction();
|
---|
97 | QStringList tables(const QString& typeName) const;
|
---|
98 |
|
---|
99 | QSqlRecord record(const QString& tablename) const;
|
---|
100 | QSqlRecordInfo recordInfo(const QString& tablename) const;
|
---|
101 | QSqlIndex primaryIndex(const QString &table) const;
|
---|
102 | QSqlRecord record(const QSqlQuery& query) const;
|
---|
103 | QSqlRecordInfo recordInfo(const QSqlQuery& query) const;
|
---|
104 |
|
---|
105 | QString formatValue(const QSqlField* field, bool trimStrings) const;
|
---|
106 |
|
---|
107 | private:
|
---|
108 | QIBaseDriverPrivate* d;
|
---|
109 | };
|
---|
110 |
|
---|
111 |
|
---|
112 | #endif
|
---|
113 |
|
---|