source: trunk/src/sql/drivers/db2/qsql_db2.h@ 651

Last change on this file since 651 was 651, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.2 sources.

File size: 3.9 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the QtSql module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QSQL_DB2_H
43#define QSQL_DB2_H
44
45#ifdef QT_PLUGIN
46#define Q_EXPORT_SQLDRIVER_DB2
47#else
48#define Q_EXPORT_SQLDRIVER_DB2 Q_SQL_EXPORT
49#endif
50
51#include <QtSql/qsqlresult.h>
52#include <QtSql/qsqldriver.h>
53
54QT_BEGIN_HEADER
55
56QT_BEGIN_NAMESPACE
57class QDB2Driver;
58class QDB2DriverPrivate;
59class QDB2ResultPrivate;
60class QSqlRecord;
61
62class QDB2Result : public QSqlResult
63{
64public:
65 QDB2Result(const QDB2Driver* dr, const QDB2DriverPrivate* dp);
66 ~QDB2Result();
67 bool prepare(const QString& query);
68 bool exec();
69 QVariant handle() const;
70
71protected:
72 QVariant data(int field);
73 bool reset (const QString& query);
74 bool fetch(int i);
75 bool fetchNext();
76 bool fetchFirst();
77 bool fetchLast();
78 bool isNull(int i);
79 int size();
80 int numRowsAffected();
81 QSqlRecord record() const;
82 void virtual_hook(int id, void *data);
83 bool nextResult();
84
85private:
86 QDB2ResultPrivate* d;
87};
88
89class Q_EXPORT_SQLDRIVER_DB2 QDB2Driver : public QSqlDriver
90{
91 Q_OBJECT
92public:
93 explicit QDB2Driver(QObject* parent = 0);
94 QDB2Driver(Qt::HANDLE env, Qt::HANDLE con, QObject* parent = 0);
95 ~QDB2Driver();
96 bool hasFeature(DriverFeature) const;
97 void close();
98 QSqlRecord record(const QString& tableName) const;
99 QStringList tables(QSql::TableType type) const;
100 QSqlResult *createResult() const;
101 QSqlIndex primaryIndex(const QString& tablename) const;
102 bool beginTransaction();
103 bool commitTransaction();
104 bool rollbackTransaction();
105 QString formatValue(const QSqlField &field, bool trimStrings) const;
106 QVariant handle() const;
107 bool open(const QString& db,
108 const QString& user,
109 const QString& password,
110 const QString& host,
111 int port,
112 const QString& connOpts);
113 QString escapeIdentifier(const QString &identifier, IdentifierType type) const;
114
115private:
116 bool setAutoCommit(bool autoCommit);
117 QDB2DriverPrivate* d;
118};
119
120QT_END_NAMESPACE
121
122QT_END_HEADER
123
124#endif // QSQL_DB2_H
Note: See TracBrowser for help on using the repository browser.