summaryrefslogtreecommitdiffstats
path: root/src/sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/sql')
-rw-r--r--src/sql/drivers/db2/qsql_db2.cpp33
-rw-r--r--src/sql/drivers/db2/qsql_db2_p.h32
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp39
-rw-r--r--src/sql/drivers/mysql/qsql_mysql_p.h37
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp36
-rw-r--r--src/sql/drivers/odbc/qsql_odbc_p.h37
-rw-r--r--src/sql/drivers/psql/qsql_psql.cpp29
-rw-r--r--src/sql/drivers/psql/qsql_psql_p.h33
8 files changed, 134 insertions, 142 deletions
diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp
index dd49963d93..7282d3a655 100644
--- a/src/sql/drivers/db2/qsql_db2.cpp
+++ b/src/sql/drivers/db2/qsql_db2.cpp
@@ -32,7 +32,6 @@
****************************************************************************/
#include "qsql_db2_p.h"
-#include <QtSql/private/qsqldriver_p.h>
#include <qcoreapplication.h>
#include <qdatetime.h>
#include <qsqlfield.h>
@@ -43,6 +42,8 @@
#include <qvarlengtharray.h>
#include <qvector.h>
#include <QDebug>
+#include <QtSql/private/qsqldriver_p.h>
+#include <QtSql/private/qsqlresult_p.h>
#if defined(Q_CC_BOR)
// DB2's sqlsystm.h (included through sqlcli1.h) defines the SQL_BIGINT_TYPE
@@ -72,6 +73,36 @@ public:
QString user;
};
+class QDB2ResultPrivate;
+
+class QDB2Result: public QSqlResult
+{
+public:
+ QDB2Result(const QDB2Driver *dr, const QDB2DriverPrivate *dp);
+ ~QDB2Result();
+ bool prepare(const QString &query);
+ bool exec();
+ QVariant handle() const;
+
+protected:
+ QVariant data(int field);
+ bool reset (const QString &query);
+ bool fetch(int i);
+ bool fetchNext();
+ bool fetchFirst();
+ bool fetchLast();
+ bool isNull(int i);
+ int size();
+ int numRowsAffected();
+ QSqlRecord record() const;
+ void virtual_hook(int id, void *data);
+ void detachFromResultSet();
+ bool nextResult();
+
+private:
+ QDB2ResultPrivate *d;
+};
+
class QDB2ResultPrivate
{
public:
diff --git a/src/sql/drivers/db2/qsql_db2_p.h b/src/sql/drivers/db2/qsql_db2_p.h
index 7b5d751b89..f3f081f731 100644
--- a/src/sql/drivers/db2/qsql_db2_p.h
+++ b/src/sql/drivers/db2/qsql_db2_p.h
@@ -53,43 +53,11 @@
#define Q_EXPORT_SQLDRIVER_DB2 Q_SQL_EXPORT
#endif
-#include <QtSql/qsqlresult.h>
#include <QtSql/qsqldriver.h>
QT_BEGIN_NAMESPACE
-class QDB2Driver;
class QDB2DriverPrivate;
-class QDB2ResultPrivate;
-class QSqlRecord;
-
-class QDB2Result : public QSqlResult
-{
-public:
- QDB2Result(const QDB2Driver* dr, const QDB2DriverPrivate* dp);
- ~QDB2Result();
- bool prepare(const QString& query);
- bool exec();
- QVariant handle() const;
-
-protected:
- QVariant data(int field);
- bool reset (const QString& query);
- bool fetch(int i);
- bool fetchNext();
- bool fetchFirst();
- bool fetchLast();
- bool isNull(int i);
- int size();
- int numRowsAffected();
- QSqlRecord record() const;
- void virtual_hook(int id, void *data);
- void detachFromResultSet();
- bool nextResult();
-
-private:
- QDB2ResultPrivate* d;
-};
class Q_EXPORT_SQLDRIVER_DB2 QDB2Driver : public QSqlDriver
{
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index 96bdcc42fa..739d605911 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -33,7 +33,6 @@
#include "qsql_mysql_p.h"
-#include <QtSql/private/qsqldriver_p.h>
#include <qcoreapplication.h>
#include <qvariant.h>
#include <qdatetime.h>
@@ -46,8 +45,9 @@
#include <qtextcodec.h>
#include <qvector.h>
#include <qfile.h>
-
#include <qdebug.h>
+#include <QtSql/private/qsqldriver_p.h>
+#include <QtSql/private/qsqlresult_p.h>
#ifdef Q_OS_WIN32
// comment the next line out if you want to use MySQL/embedded on Win32 systems.
@@ -156,6 +156,41 @@ static inline QVariant qDateTimeFromString(QString &val)
#endif
}
+class QMYSQLResultPrivate;
+
+class QMYSQLResult : public QSqlResult
+{
+ friend class QMYSQLDriver;
+ friend class QMYSQLResultPrivate;
+public:
+ explicit QMYSQLResult(const QMYSQLDriver *db);
+ ~QMYSQLResult();
+
+ QVariant handle() const Q_DECL_OVERRIDE;
+protected:
+ void cleanup();
+ bool fetch(int i) Q_DECL_OVERRIDE;
+ bool fetchNext() Q_DECL_OVERRIDE;
+ bool fetchLast() Q_DECL_OVERRIDE;
+ bool fetchFirst() Q_DECL_OVERRIDE;
+ QVariant data(int field) Q_DECL_OVERRIDE;
+ bool isNull(int field) Q_DECL_OVERRIDE;
+ bool reset (const QString& query) Q_DECL_OVERRIDE;
+ int size() Q_DECL_OVERRIDE;
+ int numRowsAffected() Q_DECL_OVERRIDE;
+ QVariant lastInsertId() const Q_DECL_OVERRIDE;
+ QSqlRecord record() const Q_DECL_OVERRIDE;
+ void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
+ bool nextResult() Q_DECL_OVERRIDE;
+
+#if MYSQL_VERSION_ID >= 40108
+ bool prepare(const QString &stmt) Q_DECL_OVERRIDE;
+ bool exec() Q_DECL_OVERRIDE;
+#endif
+private:
+ QMYSQLResultPrivate *d;
+};
+
class QMYSQLResultPrivate : public QObject
{
Q_OBJECT
diff --git a/src/sql/drivers/mysql/qsql_mysql_p.h b/src/sql/drivers/mysql/qsql_mysql_p.h
index 724cc1fd28..7fb02d202c 100644
--- a/src/sql/drivers/mysql/qsql_mysql_p.h
+++ b/src/sql/drivers/mysql/qsql_mysql_p.h
@@ -46,7 +46,6 @@
//
#include <QtSql/qsqldriver.h>
-#include <QtSql/qsqlresult.h>
#if defined (Q_OS_WIN32)
#include <QtCore/qt_windows.h>
@@ -63,42 +62,6 @@
QT_BEGIN_NAMESPACE
class QMYSQLDriverPrivate;
-class QMYSQLResultPrivate;
-class QMYSQLDriver;
-class QSqlRecordInfo;
-
-class QMYSQLResult : public QSqlResult
-{
- friend class QMYSQLDriver;
- friend class QMYSQLResultPrivate;
-public:
- explicit QMYSQLResult(const QMYSQLDriver* db);
- ~QMYSQLResult();
-
- QVariant handle() const Q_DECL_OVERRIDE;
-protected:
- void cleanup();
- bool fetch(int i) Q_DECL_OVERRIDE;
- bool fetchNext() Q_DECL_OVERRIDE;
- bool fetchLast() Q_DECL_OVERRIDE;
- bool fetchFirst() Q_DECL_OVERRIDE;
- QVariant data(int field) Q_DECL_OVERRIDE;
- bool isNull(int field) Q_DECL_OVERRIDE;
- bool reset (const QString& query) Q_DECL_OVERRIDE;
- int size() Q_DECL_OVERRIDE;
- int numRowsAffected() Q_DECL_OVERRIDE;
- QVariant lastInsertId() const Q_DECL_OVERRIDE;
- QSqlRecord record() const Q_DECL_OVERRIDE;
- void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
- bool nextResult() Q_DECL_OVERRIDE;
-
-#if MYSQL_VERSION_ID >= 40108
- bool prepare(const QString& stmt) Q_DECL_OVERRIDE;
- bool exec() Q_DECL_OVERRIDE;
-#endif
-private:
- QMYSQLResultPrivate* d;
-};
class Q_EXPORT_SQLDRIVER_MYSQL QMYSQLDriver : public QSqlDriver
{
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 8c4ec484cc..19d669b8c3 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -50,6 +50,7 @@
#include <QDebug>
#include <QSqlQuery>
#include <QtSql/private/qsqldriver_p.h>
+#include <QtSql/private/qsqlresult_p.h>
QT_BEGIN_NAMESPACE
@@ -143,6 +144,41 @@ private:
QChar quote;
};
+class QODBCResultPrivate;
+
+class QODBCResult: public QSqlResult
+{
+public:
+ QODBCResult(const QODBCDriver *db, QODBCDriverPrivate *p);
+ virtual ~QODBCResult();
+
+ bool prepare(const QString &query);
+ bool exec();
+
+ QVariant lastInsertId() const;
+ QVariant handle() const;
+ virtual void setForwardOnly(bool forward);
+
+protected:
+ bool fetchNext();
+ bool fetchFirst();
+ bool fetchLast();
+ bool fetchPrevious();
+ bool fetch(int i);
+ bool reset (const QString &query);
+ QVariant data(int field);
+ bool isNull(int field);
+ int size();
+ int numRowsAffected();
+ QSqlRecord record() const;
+ void virtual_hook(int id, void *data);
+ void detachFromResultSet();
+ bool nextResult();
+
+private:
+ QODBCResultPrivate *d;
+};
+
class QODBCResultPrivate
{
public:
diff --git a/src/sql/drivers/odbc/qsql_odbc_p.h b/src/sql/drivers/odbc/qsql_odbc_p.h
index 9c864b467d..407280ebb9 100644
--- a/src/sql/drivers/odbc/qsql_odbc_p.h
+++ b/src/sql/drivers/odbc/qsql_odbc_p.h
@@ -46,7 +46,6 @@
//
#include <QtSql/qsqldriver.h>
-#include <QtSql/qsqlresult.h>
#if defined (Q_OS_WIN32)
#include <QtCore/qt_windows.h>
@@ -75,43 +74,7 @@
QT_BEGIN_NAMESPACE
-class QODBCResultPrivate;
class QODBCDriverPrivate;
-class QODBCDriver;
-class QSqlRecordInfo;
-
-class QODBCResult : public QSqlResult
-{
-public:
- QODBCResult(const QODBCDriver * db, QODBCDriverPrivate* p);
- virtual ~QODBCResult();
-
- bool prepare(const QString& query);
- bool exec();
-
- QVariant lastInsertId() const;
- QVariant handle() const;
- virtual void setForwardOnly(bool forward);
-
-protected:
- bool fetchNext();
- bool fetchFirst();
- bool fetchLast();
- bool fetchPrevious();
- bool fetch(int i);
- bool reset (const QString& query);
- QVariant data(int field);
- bool isNull(int field);
- int size();
- int numRowsAffected();
- QSqlRecord record() const;
- void virtual_hook(int id, void *data);
- void detachFromResultSet();
- bool nextResult();
-
-private:
- QODBCResultPrivate *d;
-};
class Q_EXPORT_SQLDRIVER_ODBC QODBCDriver : public QSqlDriver
{
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp
index 5dcabb0646..781317c46a 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/sql/drivers/psql/qsql_psql.cpp
@@ -119,6 +119,35 @@ inline void qPQfreemem(void *buffer)
PQfreemem(buffer);
}
+class QPSQLResultPrivate;
+
+class QPSQLResult: public QSqlResult
+{
+ Q_DECLARE_PRIVATE(QPSQLResult)
+
+public:
+ QPSQLResult(const QPSQLDriver *db);
+ ~QPSQLResult();
+
+ QVariant handle() const Q_DECL_OVERRIDE;
+ void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
+
+protected:
+ void cleanup();
+ bool fetch(int i) Q_DECL_OVERRIDE;
+ bool fetchFirst() Q_DECL_OVERRIDE;
+ bool fetchLast() Q_DECL_OVERRIDE;
+ QVariant data(int i) Q_DECL_OVERRIDE;
+ bool isNull(int field) Q_DECL_OVERRIDE;
+ bool reset (const QString &query) Q_DECL_OVERRIDE;
+ int size() Q_DECL_OVERRIDE;
+ int numRowsAffected() Q_DECL_OVERRIDE;
+ QSqlRecord record() const Q_DECL_OVERRIDE;
+ QVariant lastInsertId() const Q_DECL_OVERRIDE;
+ bool prepare(const QString &query) Q_DECL_OVERRIDE;
+ bool exec() Q_DECL_OVERRIDE;
+};
+
class QPSQLDriverPrivate : public QSqlDriverPrivate
{
Q_DECLARE_PUBLIC(QPSQLDriver)
diff --git a/src/sql/drivers/psql/qsql_psql_p.h b/src/sql/drivers/psql/qsql_psql_p.h
index 61e201ae5e..d989f70ae3 100644
--- a/src/sql/drivers/psql/qsql_psql_p.h
+++ b/src/sql/drivers/psql/qsql_psql_p.h
@@ -45,7 +45,6 @@
// We mean it.
//
-#include <QtSql/qsqlresult.h>
#include <QtSql/qsqldriver.h>
#ifdef QT_PLUGIN
@@ -59,44 +58,12 @@ typedef struct pg_result PGresult;
QT_BEGIN_NAMESPACE
-class QPSQLResultPrivate;
-class QPSQLDriver;
-class QSqlRecordInfo;
-
-class QPSQLResult : public QSqlResult
-{
- Q_DECLARE_PRIVATE(QPSQLResult)
-
-public:
- QPSQLResult(const QPSQLDriver* db);
- ~QPSQLResult();
-
- QVariant handle() const Q_DECL_OVERRIDE;
- void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
-
-protected:
- void cleanup();
- bool fetch(int i) Q_DECL_OVERRIDE;
- bool fetchFirst() Q_DECL_OVERRIDE;
- bool fetchLast() Q_DECL_OVERRIDE;
- QVariant data(int i) Q_DECL_OVERRIDE;
- bool isNull(int field) Q_DECL_OVERRIDE;
- bool reset (const QString& query) Q_DECL_OVERRIDE;
- int size() Q_DECL_OVERRIDE;
- int numRowsAffected() Q_DECL_OVERRIDE;
- QSqlRecord record() const Q_DECL_OVERRIDE;
- QVariant lastInsertId() const Q_DECL_OVERRIDE;
- bool prepare(const QString& query) Q_DECL_OVERRIDE;
- bool exec() Q_DECL_OVERRIDE;
-};
-
class QPSQLDriverPrivate;
class Q_EXPORT_SQLDRIVER_PSQL QPSQLDriver : public QSqlDriver
{
friend class QPSQLResultPrivate;
Q_DECLARE_PRIVATE(QPSQLDriver)
-
Q_OBJECT
public:
enum Protocol {