QtSql/qsql_db2.h Source File

qsql_db2.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtSql module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
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 
55 
57 class QDB2Driver;
58 class QDB2DriverPrivate;
59 class QDB2ResultPrivate;
60 class QSqlRecord;
61 
62 class QDB2Result : public QSqlResult
63 {
64 public:
65  QDB2Result(const QDB2Driver* dr, const QDB2DriverPrivate* dp);
66  ~QDB2Result();
67  bool prepare(const QString& query);
68  bool exec();
69  QVariant handle() const;
70 
71 protected:
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 
85 private:
86  QDB2ResultPrivate* d;
87 };
88 
90 {
91  Q_OBJECT
92 public:
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;
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 
115 private:
116  bool setAutoCommit(bool autoCommit);
117  QDB2DriverPrivate* d;
118 };
119 
121 
123 
124 #endif // QSQL_DB2_H
GLuint GLuint GLsizei GLenum type
Definition: GLee.h:872
#define QT_END_NAMESPACE
Definition: qglobal.h:128
virtual QStringList tables(QSql::TableType tableType) const
QVariant handle() const
#define QT_BEGIN_HEADER
Definition: qglobal.h:141
QVariant data(int field)
bool nextResult()
void virtual_hook(int id, void *data)
QDB2Result(const QDB2Driver *dr, const QDB2DriverPrivate *dp)
bool prepare(const QString &query)
virtual QString formatValue(const QSqlField &field, bool trimStrings=false) const
QSqlRecord record() const
virtual bool hasFeature(DriverFeature f) const =0
virtual void close()=0
#define Q_EXPORT_SQLDRIVER_DB2
Definition: qsql_db2.h:48
bool exec()
#define QT_BEGIN_NAMESPACE
Definition: qglobal.h:127
bool isNull(int i)
bool fetchLast()
#define Q_OBJECT
Definition: qobjectdefs.h:157
virtual bool rollbackTransaction()
virtual bool commitTransaction()
virtual bool open(const QString &db, const QString &user=QString(), const QString &password=QString(), const QString &host=QString(), int port=-1, const QString &connOpts=QString())=0
bool fetch(int i)
unsigned long HANDLE
Definition: qnamespace.h:1675
bool fetchNext()
virtual QSqlResult * createResult() const =0
int numRowsAffected()
virtual QSqlRecord record(const QString &tableName) const
virtual QSqlIndex primaryIndex(const QString &tableName) const
bool reset(const QString &query)
bool fetchFirst()
virtual QVariant handle() const
TableType
Definition: qsql.h:74
#define QT_END_HEADER
Definition: qglobal.h:142
virtual bool beginTransaction()
virtual QString escapeIdentifier(const QString &identifier, IdentifierType type) const