Qt 4.8
qsql_ibase.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_IBASE_H
43 #define QSQL_IBASE_H
44 
45 #include <QtSql/qsqlresult.h>
46 #include <QtSql/qsqldriver.h>
47 #include <QtSql/private/qsqlcachedresult_p.h>
48 #include <ibase.h>
49 
51 
55 class QIBaseDriver;
56 
58 {
59  friend class QIBaseResultPrivate;
60 
61 public:
62  explicit QIBaseResult(const QIBaseDriver* db);
63  virtual ~QIBaseResult();
64 
65  bool prepare(const QString& query);
66  bool exec();
67  QVariant handle() const;
68 
69 protected:
70  bool gotoNext(QSqlCachedResult::ValueCache& row, int rowIdx);
71  bool reset (const QString& query);
72  int size();
73  int numRowsAffected();
74  QSqlRecord record() const;
75 
76 private:
78 };
79 
80 class QIBaseDriver : public QSqlDriver
81 {
82  Q_OBJECT
83  friend class QIBaseDriverPrivate;
84  friend class QIBaseResultPrivate;
85 public:
86  explicit QIBaseDriver(QObject *parent = 0);
87  explicit QIBaseDriver(isc_db_handle connection, QObject *parent = 0);
88  virtual ~QIBaseDriver();
89  bool hasFeature(DriverFeature f) const;
90  bool open(const QString & db,
91  const QString & user,
92  const QString & password,
93  const QString & host,
94  int port,
95  const QString & connOpts);
96  bool open(const QString & db,
97  const QString & user,
98  const QString & password,
99  const QString & host,
100  int port) { return open (db, user, password, host, port, QString()); }
101  void close();
102  QSqlResult *createResult() const;
103  bool beginTransaction();
104  bool commitTransaction();
105  bool rollbackTransaction();
106  QStringList tables(QSql::TableType) const;
107 
108  QSqlRecord record(const QString& tablename) const;
109  QSqlIndex primaryIndex(const QString &table) const;
110 
111  QString formatValue(const QSqlField &field, bool trimStrings) const;
112  QVariant handle() const;
113 
114  QString escapeIdentifier(const QString &identifier, IdentifierType type) const;
115 
116 protected Q_SLOTS:
117  bool subscribeToNotificationImplementation(const QString &name);
118  bool unsubscribeFromNotificationImplementation(const QString &name);
119  QStringList subscribedToNotificationsImplementation() const;
120 
121 private Q_SLOTS:
122  void qHandleEventNotification(void* updatedResultBuffer);
123 
124 private:
126 };
127 
129 
131 #endif // QSQL_IBASE_H
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
The QSqlIndex class provides functions to manipulate and describe database indexes.
Definition: qsqlindex.h:55
int type
Definition: qmetatype.cpp:239
QIBaseDriverPrivate * d
Definition: qsql_ibase.h:125
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
bool gotoNext(QSqlCachedResult::ValueCache &row, int rowIdx)
QSqlRecord record() const
Returns the current record if the query is active; otherwise returns an empty QSqlRecord.
DriverFeature
This enum contains a list of features a driver might support.
Definition: qsqldriver.h:75
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
virtual ~QIBaseResult()
Definition: qsql_ibase.cpp:876
bool exec()
Executes the query, returning true if successful; otherwise returns false.
Definition: qsql_ibase.cpp:957
const QIBaseDriver * db
Definition: qsql_ibase.cpp:379
The QSqlRecord class encapsulates a database record.
Definition: qsqlrecord.h:58
#define Q_SLOTS
Definition: qobjectdefs.h:71
The QSqlDriver class is an abstract base class for accessing specific SQL databases.
Definition: qsqldriver.h:68
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
const char * name
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
QVariant handle() const
Returns the low-level database handle for this result set wrapped in a QVariant or an invalid QVarian...
TableType
Definition: qsql.h:74
int size()
Returns the size of the SELECT result, or -1 if it cannot be determined or if the query is not a SELE...
#define Q_OBJECT
Definition: qobjectdefs.h:157
QIBaseResult(const QIBaseDriver *db)
Definition: qsql_ibase.cpp:870
static bool hasFeature(const QDockWidgetPrivate *priv, QDockWidget::DockWidgetFeature feature)
Definition: qdockwidget.cpp:74
QIBaseResultPrivate * d
Definition: qsql_ibase.h:77
bool reset(const QString &query)
Sets the result to use the SQL statement query for subsequent data retrieval.
bool open(const QString &db, const QString &user, const QString &password, const QString &host, int port)
Definition: qsql_ibase.h:96
The QSqlField class manipulates the fields in SQL database tables and views.
Definition: qsqlfield.h:56
int numRowsAffected()
Returns the number of rows affected by the last query executed, or -1 if it cannot be determined or i...
#define QT_END_HEADER
Definition: qglobal.h:137
The QSqlResult class provides an abstract interface for accessing data from specific SQL databases...
Definition: qsqlresult.h:63
IdentifierType
This enum contains a list of SQL identifier types.
Definition: qsqldriver.h:83
bool prepare(const QString &query)
Prepares the given query for execution; the query will normally use placeholders so that it can be ex...
Definition: qsql_ibase.cpp:881
int open(const char *, int,...)