From 5544208e2286f29cc113d268df3923f0f2a3fbee Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 24 Jan 2013 16:14:59 -0800 Subject: Fix warning about type-punned pointers The d->buffer array was 2x the required size and every other void* actually stored a DBINT (int) indicating the binding status of the null. The qIsNull function checked that value, but got the warning printed. Instead, let's just do the right thing and have a struct for each column. Solves the problem more neatly. Change-Id: I2daaf05c876da7e0e13fb983c58916d946518846 Reviewed-by: Robin Burchell Reviewed-by: Mark Brand --- src/sql/drivers/tds/qsql_tds.cpp | 42 +++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'src/sql/drivers') diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/sql/drivers/tds/qsql_tds.cpp index 45bba42ca7..b35fc682c8 100644 --- a/src/sql/drivers/tds/qsql_tds.cpp +++ b/src/sql/drivers/tds/qsql_tds.cpp @@ -145,6 +145,12 @@ public: bool initialized; }; +struct QTDSColumnData +{ + void *data; + DBINT nullbind; +}; +Q_DECLARE_TYPEINFO(QTDSColumnData, Q_MOVABLE_TYPE); class QTDSResultPrivate { @@ -156,7 +162,7 @@ public: void addErrorMsg(QString& errMsg) { errorMsgs.append(errMsg); } QString getErrorMsgs() { return errorMsgs.join(QLatin1String("\n")); } void clearErrorMsgs() { errorMsgs.clear(); } - QVector buffer; + QVector buffer; QSqlRecord rec; private: @@ -325,8 +331,8 @@ void QTDSResult::cleanup() { d->clearErrorMsgs(); d->rec.clear(); - for (int i = 0; i < d->buffer.size() / 2; ++i) - free(d->buffer.at(i * 2)); + for (int i = 0; i < d->buffer.size(); ++i) + free(d->buffer.at(i * 2).data); d->buffer.clear(); // "can" stands for "cancel"... very clever. dbcanquery(d->dbproc); @@ -340,9 +346,9 @@ QVariant QTDSResult::handle() const return QVariant(qRegisterMetaType("DBPROCESS*"), &d->dbproc); } -static inline bool qIsNull(const void *ind) +static inline bool qIsNull(const QTDSColumnData &p) { - return *reinterpret_cast(&ind) == -1; + return p.nullbind == -1; } bool QTDSResult::gotoNext(QSqlCachedResult::ValueCache &values, int index) @@ -364,33 +370,33 @@ bool QTDSResult::gotoNext(QSqlCachedResult::ValueCache &values, int index) int idx = index + i; switch (d->rec.field(i).type()) { case QVariant::DateTime: - if (qIsNull(d->buffer.at(i * 2 + 1))) { + if (qIsNull(d->buffer.at(i))) { values[idx] = QVariant(QVariant::DateTime); } else { - DBDATETIME *bdt = (DBDATETIME*) d->buffer.at(i * 2); + DBDATETIME *bdt = (DBDATETIME*) d->buffer.at(i).data; QDate date = QDate::fromString(QLatin1String("1900-01-01"), Qt::ISODate); QTime time = QTime::fromString(QLatin1String("00:00:00"), Qt::ISODate); values[idx] = QDateTime(date.addDays(bdt->dtdays), time.addMSecs(int(bdt->dttime / 0.3))); } break; case QVariant::Int: - if (qIsNull(d->buffer.at(i * 2 + 1))) + if (qIsNull(d->buffer.at(i))) values[idx] = QVariant(QVariant::Int); else - values[idx] = *((int*)d->buffer.at(i * 2)); + values[idx] = *((int*)d->buffer.at(i).data); break; case QVariant::Double: case QVariant::String: - if (qIsNull(d->buffer.at(i * 2 + 1))) + if (qIsNull(d->buffer.at(i))) values[idx] = QVariant(QVariant::String); else - values[idx] = QString::fromLocal8Bit((const char*)d->buffer.at(i * 2)).trimmed(); + values[idx] = QString::fromLocal8Bit((const char*)d->buffer.at(i).data).trimmed(); break; case QVariant::ByteArray: { - if (qIsNull(d->buffer.at(i * 2 + 1))) + if (qIsNull(d->buffer.at(i))) values[idx] = QVariant(QVariant::ByteArray); else - values[idx] = QByteArray((const char*)d->buffer.at(i * 2)); + values[idx] = QByteArray((const char*)d->buffer.at(i).data); break; } default: @@ -430,7 +436,7 @@ bool QTDSResult::reset (const QString& query) setSelect((DBCMDROW(d->dbproc) == SUCCEED)); // decide whether or not we are dealing with a SELECT query int numCols = dbnumcols(d->dbproc); if (numCols > 0) { - d->buffer.resize(numCols * 2); + d->buffer.resize(numCols); init(numCols); } for (int i = 0; i < numCols; ++i) { @@ -470,11 +476,11 @@ bool QTDSResult::reset (const QString& query) break; } if (ret == SUCCEED) { - d->buffer[i * 2] = p; - ret = dbnullbind(d->dbproc, i+1, (DBINT*)(&d->buffer[i * 2 + 1])); + d->buffer[i].data = p; + ret = dbnullbind(d->dbproc, i+1, &d->buffer[i].nullbind); } else { - d->buffer[i * 2] = 0; - d->buffer[i * 2 + 1] = 0; + d->buffer[i].data = 0; + d->buffer[i].nullbind = 0; free(p); } if ((ret != SUCCEED) && (ret != -1)) { -- cgit v1.2.3 From 07e3bcdc106ac42703ae0fb88b6cac2d2bfdd072 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Sat, 26 Jan 2013 21:42:12 +0100 Subject: Remove QT_{BEGIN,END}_HEADER macro usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp Reviewed-by: Jędrzej Nowacki Reviewed-by: hjk --- src/sql/drivers/db2/qsql_db2.h | 4 ---- src/sql/drivers/ibase/qsql_ibase.h | 3 --- src/sql/drivers/mysql/qsql_mysql.h | 4 ---- src/sql/drivers/oci/qsql_oci.h | 4 ---- src/sql/drivers/odbc/qsql_odbc.h | 4 ---- src/sql/drivers/psql/qsql_psql.h | 4 ---- src/sql/drivers/sqlite/qsql_sqlite.h | 4 ---- src/sql/drivers/sqlite2/qsql_sqlite2.h | 4 ---- src/sql/drivers/tds/qsql_tds.h | 4 ---- 9 files changed, 35 deletions(-) (limited to 'src/sql/drivers') diff --git a/src/sql/drivers/db2/qsql_db2.h b/src/sql/drivers/db2/qsql_db2.h index 4e25c317eb..5d31906096 100644 --- a/src/sql/drivers/db2/qsql_db2.h +++ b/src/sql/drivers/db2/qsql_db2.h @@ -51,8 +51,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE #if 0 @@ -126,6 +124,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QSQL_DB2_H diff --git a/src/sql/drivers/ibase/qsql_ibase.h b/src/sql/drivers/ibase/qsql_ibase.h index 2ce20966c6..d47bd6d4b4 100644 --- a/src/sql/drivers/ibase/qsql_ibase.h +++ b/src/sql/drivers/ibase/qsql_ibase.h @@ -47,8 +47,6 @@ #include #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE #if 0 @@ -132,5 +130,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER #endif // QSQL_IBASE_H diff --git a/src/sql/drivers/mysql/qsql_mysql.h b/src/sql/drivers/mysql/qsql_mysql.h index 37e18c8fb1..953216de9a 100644 --- a/src/sql/drivers/mysql/qsql_mysql.h +++ b/src/sql/drivers/mysql/qsql_mysql.h @@ -57,8 +57,6 @@ #define Q_EXPORT_SQLDRIVER_MYSQL Q_SQL_EXPORT #endif -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE #if 0 @@ -142,6 +140,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QSQL_MYSQL_H diff --git a/src/sql/drivers/oci/qsql_oci.h b/src/sql/drivers/oci/qsql_oci.h index 2488e696d2..797f967381 100644 --- a/src/sql/drivers/oci/qsql_oci.h +++ b/src/sql/drivers/oci/qsql_oci.h @@ -52,8 +52,6 @@ #define Q_EXPORT_SQLDRIVER_OCI Q_SQL_EXPORT #endif -QT_BEGIN_HEADER - typedef struct OCIEnv OCIEnv; typedef struct OCISvcCtx OCISvcCtx; @@ -131,6 +129,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QSQL_OCI_H diff --git a/src/sql/drivers/odbc/qsql_odbc.h b/src/sql/drivers/odbc/qsql_odbc.h index 4fba49b9c5..26f47e6c74 100644 --- a/src/sql/drivers/odbc/qsql_odbc.h +++ b/src/sql/drivers/odbc/qsql_odbc.h @@ -70,8 +70,6 @@ #include -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE #if 0 @@ -158,6 +156,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QSQL_ODBC_H diff --git a/src/sql/drivers/psql/qsql_psql.h b/src/sql/drivers/psql/qsql_psql.h index 444ef1bccc..d5585a45fa 100644 --- a/src/sql/drivers/psql/qsql_psql.h +++ b/src/sql/drivers/psql/qsql_psql.h @@ -51,8 +51,6 @@ #define Q_EXPORT_SQLDRIVER_PSQL Q_SQL_EXPORT #endif -QT_BEGIN_HEADER - typedef struct pg_conn PGconn; typedef struct pg_result PGresult; @@ -158,6 +156,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QSQL_PSQL_H diff --git a/src/sql/drivers/sqlite/qsql_sqlite.h b/src/sql/drivers/sqlite/qsql_sqlite.h index 0fdcd4e240..d53e0275d6 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.h +++ b/src/sql/drivers/sqlite/qsql_sqlite.h @@ -54,8 +54,6 @@ struct sqlite3; #define Q_EXPORT_SQLDRIVER_SQLITE Q_SQL_EXPORT #endif -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE #if 0 @@ -125,6 +123,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QSQL_SQLITE_H diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.h b/src/sql/drivers/sqlite2/qsql_sqlite2.h index f141ad1cc2..a91a7c58f1 100644 --- a/src/sql/drivers/sqlite2/qsql_sqlite2.h +++ b/src/sql/drivers/sqlite2/qsql_sqlite2.h @@ -54,8 +54,6 @@ struct sqlite; -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE #if 0 @@ -127,6 +125,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QSQL_SQLITE2_H diff --git a/src/sql/drivers/tds/qsql_tds.h b/src/sql/drivers/tds/qsql_tds.h index 38cb2dc42e..5a158cfdcc 100644 --- a/src/sql/drivers/tds/qsql_tds.h +++ b/src/sql/drivers/tds/qsql_tds.h @@ -67,8 +67,6 @@ #define Q_EXPORT_SQLDRIVER_TDS Q_SQL_EXPORT #endif -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE #if 0 @@ -137,6 +135,4 @@ private: QT_END_NAMESPACE -QT_END_HEADER - #endif // QSQL_TDS_H -- cgit v1.2.3 From 1580f558472e2c37936fe817fc546a79a8b0a9a5 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 30 Jan 2013 10:36:50 +0100 Subject: Remove dependency of DB driver headers on qsqlcachedresult_p.h. Move the QXXResult classes inheriting the private class QSqlCachedResult from header into the source files for SQLite, SQLite2, Interbase/Firebird and TDS/Sybase and Oracle. Task-number: QTBUG-28088 Change-Id: Ia16d30e442e313c8165282b8a3f012fd95d96759 Reviewed-by: Andy Shaw Reviewed-by: Mark Brand --- src/sql/drivers/ibase/qsql_ibase.cpp | 49 ++++++++++++++++++++++++++++++++ src/sql/drivers/ibase/qsql_ibase.h | 25 ---------------- src/sql/drivers/oci/qsql_oci.cpp | 28 ++++++++++++++++++ src/sql/drivers/oci/qsql_oci.h | 28 ------------------ src/sql/drivers/sqlite/qsql_sqlite.cpp | 28 ++++++++++++++++++ src/sql/drivers/sqlite/qsql_sqlite.h | 27 ------------------ src/sql/drivers/sqlite2/qsql_sqlite2.cpp | 25 ++++++++++++++++ src/sql/drivers/sqlite2/qsql_sqlite2.h | 24 ---------------- src/sql/drivers/tds/qsql_tds.cpp | 22 ++++++++++++++ src/sql/drivers/tds/qsql_tds.h | 21 -------------- 10 files changed, 152 insertions(+), 125 deletions(-) (limited to 'src/sql/drivers') diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index 5fd07318ec..22b4b81953 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -346,6 +347,54 @@ static void qFreeEventBuffer(QIBaseEventBuffer* eBuffer) delete eBuffer; } +class QIBaseResult : public QSqlCachedResult +{ + friend class QIBaseResultPrivate; + +public: + explicit QIBaseResult(const QIBaseDriver* db); + virtual ~QIBaseResult(); + + bool prepare(const QString& query); + bool exec(); + QVariant handle() const; + +protected: + bool gotoNext(QSqlCachedResult::ValueCache& row, int rowIdx); + bool reset (const QString& query); + int size(); + int numRowsAffected(); + QSqlRecord record() const; + +private: + QIBaseResultPrivate* d; +}; + +class QIBaseResultPrivate; + +class QIBaseResult : public QSqlCachedResult +{ + friend class QIBaseResultPrivate; + +public: + explicit QIBaseResult(const QIBaseDriver* db); + virtual ~QIBaseResult(); + + bool prepare(const QString& query); + bool exec(); + QVariant handle() const; + +protected: + bool gotoNext(QSqlCachedResult::ValueCache& row, int rowIdx); + bool reset (const QString& query); + int size(); + int numRowsAffected(); + QSqlRecord record() const; + +private: + QIBaseResultPrivate* d; +}; + class QIBaseResultPrivate { public: diff --git a/src/sql/drivers/ibase/qsql_ibase.h b/src/sql/drivers/ibase/qsql_ibase.h index d47bd6d4b4..781448b98a 100644 --- a/src/sql/drivers/ibase/qsql_ibase.h +++ b/src/sql/drivers/ibase/qsql_ibase.h @@ -44,7 +44,6 @@ #include #include -#include #include QT_BEGIN_NAMESPACE @@ -55,32 +54,8 @@ QT_BEGIN_NAMESPACE #endif class QIBaseDriverPrivate; -class QIBaseResultPrivate; class QIBaseDriver; -class QIBaseResult : public QSqlCachedResult -{ - friend class QIBaseResultPrivate; - -public: - explicit QIBaseResult(const QIBaseDriver* db); - virtual ~QIBaseResult(); - - bool prepare(const QString& query); - bool exec(); - QVariant handle() const; - -protected: - bool gotoNext(QSqlCachedResult::ValueCache& row, int rowIdx); - bool reset (const QString& query); - int size(); - int numRowsAffected(); - QSqlRecord record() const; - -private: - QIBaseResultPrivate* d; -}; - class QIBaseDriver : public QSqlDriver { Q_OBJECT diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index e2bb9a4eaf..db73f8f6ea 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -162,6 +163,33 @@ Q_DECLARE_METATYPE(QOCIRowIdPointer) QT_END_INCLUDE_NAMESPACE class QOCICols; +struct QOCIResultPrivate; + +class Q_EXPORT_SQLDRIVER_OCI QOCIResult : public QSqlCachedResult +{ + friend class QOCIDriver; + friend struct QOCIResultPrivate; + friend class QOCICols; +public: + QOCIResult(const QOCIDriver * db, const QOCIDriverPrivate* p); + ~QOCIResult(); + bool prepare(const QString& query); + bool exec(); + QVariant handle() const; + +protected: + bool gotoNext(ValueCache &values, int index); + bool reset (const QString& query); + int size(); + int numRowsAffected(); + QSqlRecord record() const; + QVariant lastInsertId() const; + bool execBatch(bool arrayBind = false); + void virtual_hook(int id, void *data); + +private: + QOCIResultPrivate *d; +}; struct QOCIResultPrivate { diff --git a/src/sql/drivers/oci/qsql_oci.h b/src/sql/drivers/oci/qsql_oci.h index 797f967381..403de623ce 100644 --- a/src/sql/drivers/oci/qsql_oci.h +++ b/src/sql/drivers/oci/qsql_oci.h @@ -44,7 +44,6 @@ #include #include -#include #ifdef QT_PLUGIN #define Q_EXPORT_SQLDRIVER_OCI @@ -65,33 +64,6 @@ QT_BEGIN_NAMESPACE class QOCIDriver; class QOCICols; struct QOCIDriverPrivate; -struct QOCIResultPrivate; - -class Q_EXPORT_SQLDRIVER_OCI QOCIResult : public QSqlCachedResult -{ - friend class QOCIDriver; - friend struct QOCIResultPrivate; - friend class QOCICols; -public: - QOCIResult(const QOCIDriver * db, const QOCIDriverPrivate* p); - ~QOCIResult(); - bool prepare(const QString& query); - bool exec(); - QVariant handle() const; - -protected: - bool gotoNext(ValueCache &values, int index); - bool reset (const QString& query); - int size(); - int numRowsAffected(); - QSqlRecord record() const; - QVariant lastInsertId() const; - bool execBatch(bool arrayBind = false); - void virtual_hook(int id, void *data); - -private: - QOCIResultPrivate *d; -}; class Q_EXPORT_SQLDRIVER_OCI QOCIDriver : public QSqlDriver { diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index f11279f262..d884bb7b11 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -106,6 +107,33 @@ static QSqlError qMakeError(sqlite3 *access, const QString &descr, QSqlError::Er type, errorCode); } +class QSQLiteResultPrivate; + +class QSQLiteResult : public QSqlCachedResult +{ + friend class QSQLiteDriver; + friend class QSQLiteResultPrivate; +public: + explicit QSQLiteResult(const QSQLiteDriver* db); + ~QSQLiteResult(); + QVariant handle() const; + +protected: + bool gotoNext(QSqlCachedResult::ValueCache& row, int idx); + bool reset(const QString &query); + bool prepare(const QString &query); + bool exec(); + int size(); + int numRowsAffected(); + QVariant lastInsertId() const; + QSqlRecord record() const; + void detachFromResultSet(); + void virtual_hook(int id, void *data); + +private: + QSQLiteResultPrivate* d; +}; + class QSQLiteDriverPrivate { public: diff --git a/src/sql/drivers/sqlite/qsql_sqlite.h b/src/sql/drivers/sqlite/qsql_sqlite.h index d53e0275d6..bd034b4d6b 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.h +++ b/src/sql/drivers/sqlite/qsql_sqlite.h @@ -44,7 +44,6 @@ #include #include -#include struct sqlite3; @@ -62,34 +61,8 @@ QT_BEGIN_NAMESPACE #endif class QSQLiteDriverPrivate; -class QSQLiteResultPrivate; class QSQLiteDriver; -class QSQLiteResult : public QSqlCachedResult -{ - friend class QSQLiteDriver; - friend class QSQLiteResultPrivate; -public: - explicit QSQLiteResult(const QSQLiteDriver* db); - ~QSQLiteResult(); - QVariant handle() const; - -protected: - bool gotoNext(QSqlCachedResult::ValueCache& row, int idx); - bool reset(const QString &query); - bool prepare(const QString &query); - bool exec(); - int size(); - int numRowsAffected(); - QVariant lastInsertId() const; - QSqlRecord record() const; - void detachFromResultSet(); - void virtual_hook(int id, void *data); - -private: - QSQLiteResultPrivate* d; -}; - class Q_EXPORT_SQLDRIVER_SQLITE QSQLiteDriver : public QSqlDriver { Q_OBJECT diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp index 02e4004901..2666cefb72 100644 --- a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp +++ b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -94,6 +95,30 @@ QSQLite2DriverPrivate::QSQLite2DriverPrivate() : access(0) utf8 = (qstrcmp(sqlite_encoding, "UTF-8") == 0); } +class QSQLite2ResultPrivate; + +class QSQLite2Result : public QSqlCachedResult +{ + friend class QSQLite2Driver; + friend class QSQLite2ResultPrivate; +public: + explicit QSQLite2Result(const QSQLite2Driver* db); + ~QSQLite2Result(); + QVariant handle() const; + +protected: + bool gotoNext(QSqlCachedResult::ValueCache& row, int idx); + bool reset (const QString& query); + int size(); + int numRowsAffected(); + QSqlRecord record() const; + void detachFromResultSet(); + void virtual_hook(int id, void *data); + +private: + QSQLite2ResultPrivate* d; +}; + class QSQLite2ResultPrivate { public: diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.h b/src/sql/drivers/sqlite2/qsql_sqlite2.h index a91a7c58f1..c6a8c4cf4f 100644 --- a/src/sql/drivers/sqlite2/qsql_sqlite2.h +++ b/src/sql/drivers/sqlite2/qsql_sqlite2.h @@ -46,7 +46,6 @@ #include #include #include -#include #if defined (Q_OS_WIN32) # include @@ -62,31 +61,8 @@ QT_BEGIN_NAMESPACE #endif class QSQLite2DriverPrivate; -class QSQLite2ResultPrivate; class QSQLite2Driver; -class QSQLite2Result : public QSqlCachedResult -{ - friend class QSQLite2Driver; - friend class QSQLite2ResultPrivate; -public: - explicit QSQLite2Result(const QSQLite2Driver* db); - ~QSQLite2Result(); - QVariant handle() const; - -protected: - bool gotoNext(QSqlCachedResult::ValueCache& row, int idx); - bool reset (const QString& query); - int size(); - int numRowsAffected(); - QSqlRecord record() const; - void detachFromResultSet(); - void virtual_hook(int id, void *data); - -private: - QSQLite2ResultPrivate* d; -}; - class QSQLite2Driver : public QSqlDriver { Q_OBJECT diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/sql/drivers/tds/qsql_tds.cpp index b35fc682c8..22773b8eff 100644 --- a/src/sql/drivers/tds/qsql_tds.cpp +++ b/src/sql/drivers/tds/qsql_tds.cpp @@ -58,6 +58,7 @@ #include #include #include +#include #include #include @@ -152,6 +153,27 @@ struct QTDSColumnData }; Q_DECLARE_TYPEINFO(QTDSColumnData, Q_MOVABLE_TYPE); +class QTDSResultPrivate; + +class QTDSResult : public QSqlCachedResult +{ +public: + explicit QTDSResult(const QTDSDriver* db); + ~QTDSResult(); + QVariant handle() const; + +protected: + void cleanup(); + bool reset (const QString& query); + int size(); + int numRowsAffected(); + bool gotoNext(QSqlCachedResult::ValueCache &values, int index); + QSqlRecord record() const; + +private: + QTDSResultPrivate* d; +}; + class QTDSResultPrivate { public: diff --git a/src/sql/drivers/tds/qsql_tds.h b/src/sql/drivers/tds/qsql_tds.h index 5a158cfdcc..2bbdd0e49c 100644 --- a/src/sql/drivers/tds/qsql_tds.h +++ b/src/sql/drivers/tds/qsql_tds.h @@ -44,7 +44,6 @@ #include #include -#include #ifdef Q_OS_WIN32 #define WIN32_LEAN_AND_MEAN @@ -75,28 +74,8 @@ QT_BEGIN_NAMESPACE #endif class QTDSDriverPrivate; -class QTDSResultPrivate; class QTDSDriver; -class QTDSResult : public QSqlCachedResult -{ -public: - explicit QTDSResult(const QTDSDriver* db); - ~QTDSResult(); - QVariant handle() const; - -protected: - void cleanup(); - bool reset (const QString& query); - int size(); - int numRowsAffected(); - bool gotoNext(QSqlCachedResult::ValueCache &values, int index); - QSqlRecord record() const; - -private: - QTDSResultPrivate* d; -}; - class Q_EXPORT_SQLDRIVER_TDS QTDSDriver : public QSqlDriver { Q_OBJECT -- cgit v1.2.3 From f9bd36deac79e2950b3ac14d08284e7dfc53aaac Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Sat, 2 Feb 2013 11:13:43 +0100 Subject: qsql ibase: remove duplicate class definition Follow-up to 1580f558472e2c37936fe817fc546a79a8b0a9a5 Task-number: QTBUG-29455 Change-Id: Id254a166ac901fb0cc0ba81db4bf1051a2acb53f Reviewed-by: Friedemann Kleint --- src/sql/drivers/ibase/qsql_ibase.cpp | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'src/sql/drivers') diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index 22b4b81953..7aff6f62fc 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -347,29 +347,6 @@ static void qFreeEventBuffer(QIBaseEventBuffer* eBuffer) delete eBuffer; } -class QIBaseResult : public QSqlCachedResult -{ - friend class QIBaseResultPrivate; - -public: - explicit QIBaseResult(const QIBaseDriver* db); - virtual ~QIBaseResult(); - - bool prepare(const QString& query); - bool exec(); - QVariant handle() const; - -protected: - bool gotoNext(QSqlCachedResult::ValueCache& row, int rowIdx); - bool reset (const QString& query); - int size(); - int numRowsAffected(); - QSqlRecord record() const; - -private: - QIBaseResultPrivate* d; -}; - class QIBaseResultPrivate; class QIBaseResult : public QSqlCachedResult -- cgit v1.2.3 From 1ee11474622e7da068fb1cd26f509ed10848a3b5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 21 Feb 2013 16:54:24 -0800 Subject: Rename the SQL driver header files to _p.h (make private) The drivers were never public API. They were exposed by mistake in public headers. What's more, they have #include'd a private header (qsqlcachedresult_p.h) since at least Qt 4.5.1. That means no one used those headers in Qt 4 (private headers weren't installed then) and it's unlikely anyone did in 5.0. Change-Id: Ie0a47bcf0260ee6bdd3d8494b78fd1eec28a2d6b Reviewed-by: Oswald Buddenhagen Reviewed-by: Friedemann Kleint Reviewed-by: Mark Brand --- src/sql/drivers/db2/qsql_db2.cpp | 2 +- src/sql/drivers/db2/qsql_db2.h | 127 ------------------------ src/sql/drivers/db2/qsql_db2.pri | 2 +- src/sql/drivers/db2/qsql_db2_p.h | 127 ++++++++++++++++++++++++ src/sql/drivers/ibase/qsql_ibase.cpp | 2 +- src/sql/drivers/ibase/qsql_ibase.h | 108 --------------------- src/sql/drivers/ibase/qsql_ibase.pri | 2 +- src/sql/drivers/ibase/qsql_ibase_p.h | 108 +++++++++++++++++++++ src/sql/drivers/mysql/qsql_mysql.cpp | 2 +- src/sql/drivers/mysql/qsql_mysql.h | 143 --------------------------- src/sql/drivers/mysql/qsql_mysql.pri | 2 +- src/sql/drivers/mysql/qsql_mysql_p.h | 143 +++++++++++++++++++++++++++ src/sql/drivers/oci/qsql_oci.cpp | 2 +- src/sql/drivers/oci/qsql_oci.h | 104 -------------------- src/sql/drivers/oci/qsql_oci.pri | 2 +- src/sql/drivers/oci/qsql_oci_p.h | 104 ++++++++++++++++++++ src/sql/drivers/odbc/qsql_odbc.cpp | 2 +- src/sql/drivers/odbc/qsql_odbc.h | 159 ------------------------------- src/sql/drivers/odbc/qsql_odbc.pri | 2 +- src/sql/drivers/odbc/qsql_odbc_p.h | 159 +++++++++++++++++++++++++++++++ src/sql/drivers/psql/qsql_psql.cpp | 2 +- src/sql/drivers/psql/qsql_psql.h | 159 ------------------------------- src/sql/drivers/psql/qsql_psql.pri | 2 +- src/sql/drivers/psql/qsql_psql_p.h | 159 +++++++++++++++++++++++++++++++ src/sql/drivers/sqlite/qsql_sqlite.cpp | 2 +- src/sql/drivers/sqlite/qsql_sqlite.h | 99 ------------------- src/sql/drivers/sqlite/qsql_sqlite.pri | 2 +- src/sql/drivers/sqlite/qsql_sqlite_p.h | 99 +++++++++++++++++++ src/sql/drivers/sqlite2/qsql_sqlite2.cpp | 2 +- src/sql/drivers/sqlite2/qsql_sqlite2.h | 104 -------------------- src/sql/drivers/sqlite2/qsql_sqlite2.pri | 2 +- src/sql/drivers/sqlite2/qsql_sqlite2_p.h | 104 ++++++++++++++++++++ src/sql/drivers/tds/qsql_tds.cpp | 2 +- src/sql/drivers/tds/qsql_tds.h | 117 ----------------------- src/sql/drivers/tds/qsql_tds.pri | 2 +- src/sql/drivers/tds/qsql_tds_p.h | 117 +++++++++++++++++++++++ 36 files changed, 1138 insertions(+), 1138 deletions(-) delete mode 100644 src/sql/drivers/db2/qsql_db2.h create mode 100644 src/sql/drivers/db2/qsql_db2_p.h delete mode 100644 src/sql/drivers/ibase/qsql_ibase.h create mode 100644 src/sql/drivers/ibase/qsql_ibase_p.h delete mode 100644 src/sql/drivers/mysql/qsql_mysql.h create mode 100644 src/sql/drivers/mysql/qsql_mysql_p.h delete mode 100644 src/sql/drivers/oci/qsql_oci.h create mode 100644 src/sql/drivers/oci/qsql_oci_p.h delete mode 100644 src/sql/drivers/odbc/qsql_odbc.h create mode 100644 src/sql/drivers/odbc/qsql_odbc_p.h delete mode 100644 src/sql/drivers/psql/qsql_psql.h create mode 100644 src/sql/drivers/psql/qsql_psql_p.h delete mode 100644 src/sql/drivers/sqlite/qsql_sqlite.h create mode 100644 src/sql/drivers/sqlite/qsql_sqlite_p.h delete mode 100644 src/sql/drivers/sqlite2/qsql_sqlite2.h create mode 100644 src/sql/drivers/sqlite2/qsql_sqlite2_p.h delete mode 100644 src/sql/drivers/tds/qsql_tds.h create mode 100644 src/sql/drivers/tds/qsql_tds_p.h (limited to 'src/sql/drivers') diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp index 9406861d4c..50a9af23bc 100644 --- a/src/sql/drivers/db2/qsql_db2.cpp +++ b/src/sql/drivers/db2/qsql_db2.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qsql_db2.h" +#include "qsql_db2_p.h" #include #include #include diff --git a/src/sql/drivers/db2/qsql_db2.h b/src/sql/drivers/db2/qsql_db2.h deleted file mode 100644 index 5d31906096..0000000000 --- a/src/sql/drivers/db2/qsql_db2.h +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtSql module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSQL_DB2_H -#define QSQL_DB2_H - -#ifdef QT_PLUGIN -#define Q_EXPORT_SQLDRIVER_DB2 -#else -#define Q_EXPORT_SQLDRIVER_DB2 Q_SQL_EXPORT -#endif - -#include -#include - -QT_BEGIN_NAMESPACE - -#if 0 -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - -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 -{ - Q_OBJECT -public: - explicit QDB2Driver(QObject* parent = 0); - QDB2Driver(Qt::HANDLE env, Qt::HANDLE con, QObject* parent = 0); - ~QDB2Driver(); - bool hasFeature(DriverFeature) const; - void close(); - QSqlRecord record(const QString& tableName) const; - QStringList tables(QSql::TableType type) const; - QSqlResult *createResult() const; - QSqlIndex primaryIndex(const QString& tablename) const; - bool beginTransaction(); - bool commitTransaction(); - bool rollbackTransaction(); - QString formatValue(const QSqlField &field, bool trimStrings) const; - QVariant handle() const; - bool open(const QString& db, - const QString& user, - const QString& password, - const QString& host, - int port, - const QString& connOpts); - QString escapeIdentifier(const QString &identifier, IdentifierType type) const; - -private: - bool setAutoCommit(bool autoCommit); - QDB2DriverPrivate* d; -}; - -QT_END_NAMESPACE - -#endif // QSQL_DB2_H diff --git a/src/sql/drivers/db2/qsql_db2.pri b/src/sql/drivers/db2/qsql_db2.pri index 963732aaee..c9e65e2c2e 100644 --- a/src/sql/drivers/db2/qsql_db2.pri +++ b/src/sql/drivers/db2/qsql_db2.pri @@ -1,4 +1,4 @@ -HEADERS += $$PWD/qsql_db2.h +HEADERS += $$PWD/qsql_db2_p.h SOURCES += $$PWD/qsql_db2.cpp unix { diff --git a/src/sql/drivers/db2/qsql_db2_p.h b/src/sql/drivers/db2/qsql_db2_p.h new file mode 100644 index 0000000000..5d31906096 --- /dev/null +++ b/src/sql/drivers/db2/qsql_db2_p.h @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_DB2_H +#define QSQL_DB2_H + +#ifdef QT_PLUGIN +#define Q_EXPORT_SQLDRIVER_DB2 +#else +#define Q_EXPORT_SQLDRIVER_DB2 Q_SQL_EXPORT +#endif + +#include +#include + +QT_BEGIN_NAMESPACE + +#if 0 +#pragma qt_no_master_include +#pragma qt_sync_stop_processing +#endif + +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 +{ + Q_OBJECT +public: + explicit QDB2Driver(QObject* parent = 0); + QDB2Driver(Qt::HANDLE env, Qt::HANDLE con, QObject* parent = 0); + ~QDB2Driver(); + bool hasFeature(DriverFeature) const; + void close(); + QSqlRecord record(const QString& tableName) const; + QStringList tables(QSql::TableType type) const; + QSqlResult *createResult() const; + QSqlIndex primaryIndex(const QString& tablename) const; + bool beginTransaction(); + bool commitTransaction(); + bool rollbackTransaction(); + QString formatValue(const QSqlField &field, bool trimStrings) const; + QVariant handle() const; + bool open(const QString& db, + const QString& user, + const QString& password, + const QString& host, + int port, + const QString& connOpts); + QString escapeIdentifier(const QString &identifier, IdentifierType type) const; + +private: + bool setAutoCommit(bool autoCommit); + QDB2DriverPrivate* d; +}; + +QT_END_NAMESPACE + +#endif // QSQL_DB2_H diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index 7aff6f62fc..abf6a74c3e 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qsql_ibase.h" +#include "qsql_ibase_p.h" #include #include #include diff --git a/src/sql/drivers/ibase/qsql_ibase.h b/src/sql/drivers/ibase/qsql_ibase.h deleted file mode 100644 index 781448b98a..0000000000 --- a/src/sql/drivers/ibase/qsql_ibase.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtSql module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSQL_IBASE_H -#define QSQL_IBASE_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -#if 0 -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - -class QIBaseDriverPrivate; -class QIBaseDriver; - -class QIBaseDriver : public QSqlDriver -{ - Q_OBJECT - friend class QIBaseDriverPrivate; - friend class QIBaseResultPrivate; -public: - explicit QIBaseDriver(QObject *parent = 0); - explicit QIBaseDriver(isc_db_handle connection, QObject *parent = 0); - virtual ~QIBaseDriver(); - bool hasFeature(DriverFeature f) const; - bool open(const QString & db, - const QString & user, - const QString & password, - const QString & host, - int port, - const QString & connOpts); - bool open(const QString & db, - const QString & user, - const QString & password, - const QString & host, - int port) { return open (db, user, password, host, port, QString()); } - void close(); - QSqlResult *createResult() const; - bool beginTransaction(); - bool commitTransaction(); - bool rollbackTransaction(); - QStringList tables(QSql::TableType) const; - - QSqlRecord record(const QString& tablename) const; - QSqlIndex primaryIndex(const QString &table) const; - - QString formatValue(const QSqlField &field, bool trimStrings) const; - QVariant handle() const; - - QString escapeIdentifier(const QString &identifier, IdentifierType type) const; - - bool subscribeToNotification(const QString &name); - bool unsubscribeFromNotification(const QString &name); - QStringList subscribedToNotifications() const; - -private Q_SLOTS: - void qHandleEventNotification(void* updatedResultBuffer); - -private: - QIBaseDriverPrivate* d; -}; - -QT_END_NAMESPACE - -#endif // QSQL_IBASE_H diff --git a/src/sql/drivers/ibase/qsql_ibase.pri b/src/sql/drivers/ibase/qsql_ibase.pri index 26017e8727..ef3b68d34e 100644 --- a/src/sql/drivers/ibase/qsql_ibase.pri +++ b/src/sql/drivers/ibase/qsql_ibase.pri @@ -1,4 +1,4 @@ -HEADERS += $$PWD/qsql_ibase.h +HEADERS += $$PWD/qsql_ibase_p.h SOURCES += $$PWD/qsql_ibase.cpp unix { diff --git a/src/sql/drivers/ibase/qsql_ibase_p.h b/src/sql/drivers/ibase/qsql_ibase_p.h new file mode 100644 index 0000000000..781448b98a --- /dev/null +++ b/src/sql/drivers/ibase/qsql_ibase_p.h @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_IBASE_H +#define QSQL_IBASE_H + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +#if 0 +#pragma qt_no_master_include +#pragma qt_sync_stop_processing +#endif + +class QIBaseDriverPrivate; +class QIBaseDriver; + +class QIBaseDriver : public QSqlDriver +{ + Q_OBJECT + friend class QIBaseDriverPrivate; + friend class QIBaseResultPrivate; +public: + explicit QIBaseDriver(QObject *parent = 0); + explicit QIBaseDriver(isc_db_handle connection, QObject *parent = 0); + virtual ~QIBaseDriver(); + bool hasFeature(DriverFeature f) const; + bool open(const QString & db, + const QString & user, + const QString & password, + const QString & host, + int port, + const QString & connOpts); + bool open(const QString & db, + const QString & user, + const QString & password, + const QString & host, + int port) { return open (db, user, password, host, port, QString()); } + void close(); + QSqlResult *createResult() const; + bool beginTransaction(); + bool commitTransaction(); + bool rollbackTransaction(); + QStringList tables(QSql::TableType) const; + + QSqlRecord record(const QString& tablename) const; + QSqlIndex primaryIndex(const QString &table) const; + + QString formatValue(const QSqlField &field, bool trimStrings) const; + QVariant handle() const; + + QString escapeIdentifier(const QString &identifier, IdentifierType type) const; + + bool subscribeToNotification(const QString &name); + bool unsubscribeFromNotification(const QString &name); + QStringList subscribedToNotifications() const; + +private Q_SLOTS: + void qHandleEventNotification(void* updatedResultBuffer); + +private: + QIBaseDriverPrivate* d; +}; + +QT_END_NAMESPACE + +#endif // QSQL_IBASE_H diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp index b4aa5cd4cc..04ba450d46 100644 --- a/src/sql/drivers/mysql/qsql_mysql.cpp +++ b/src/sql/drivers/mysql/qsql_mysql.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qsql_mysql.h" +#include "qsql_mysql_p.h" #include #include diff --git a/src/sql/drivers/mysql/qsql_mysql.h b/src/sql/drivers/mysql/qsql_mysql.h deleted file mode 100644 index 953216de9a..0000000000 --- a/src/sql/drivers/mysql/qsql_mysql.h +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtSql module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSQL_MYSQL_H -#define QSQL_MYSQL_H - -#include -#include - -#if defined (Q_OS_WIN32) -#include -#endif - -#include - -#ifdef QT_PLUGIN -#define Q_EXPORT_SQLDRIVER_MYSQL -#else -#define Q_EXPORT_SQLDRIVER_MYSQL Q_SQL_EXPORT -#endif - -QT_BEGIN_NAMESPACE - -#if 0 -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - -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; -protected: - void cleanup(); - bool fetch(int i); - bool fetchNext(); - bool fetchLast(); - bool fetchFirst(); - QVariant data(int field); - bool isNull(int field); - bool reset (const QString& query); - int size(); - int numRowsAffected(); - QVariant lastInsertId() const; - QSqlRecord record() const; - void virtual_hook(int id, void *data); - bool nextResult(); - -#if MYSQL_VERSION_ID >= 40108 - bool prepare(const QString& stmt); - bool exec(); -#endif -private: - QMYSQLResultPrivate* d; -}; - -class Q_EXPORT_SQLDRIVER_MYSQL QMYSQLDriver : public QSqlDriver -{ - Q_OBJECT - friend class QMYSQLResult; -public: - explicit QMYSQLDriver(QObject *parent=0); - explicit QMYSQLDriver(MYSQL *con, QObject * parent=0); - ~QMYSQLDriver(); - bool hasFeature(DriverFeature f) const; - bool open(const QString & db, - const QString & user, - const QString & password, - const QString & host, - int port, - const QString& connOpts); - void close(); - QSqlResult *createResult() const; - QStringList tables(QSql::TableType) const; - QSqlIndex primaryIndex(const QString& tablename) const; - QSqlRecord record(const QString& tablename) const; - QString formatValue(const QSqlField &field, - bool trimStrings) const; - QVariant handle() const; - QString escapeIdentifier(const QString &identifier, IdentifierType type) const; - - bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const; - -protected: - bool beginTransaction(); - bool commitTransaction(); - bool rollbackTransaction(); -private: - void init(); - QMYSQLDriverPrivate* d; -}; - -QT_END_NAMESPACE - -#endif // QSQL_MYSQL_H diff --git a/src/sql/drivers/mysql/qsql_mysql.pri b/src/sql/drivers/mysql/qsql_mysql.pri index 0423eb4ed9..50f49ca548 100644 --- a/src/sql/drivers/mysql/qsql_mysql.pri +++ b/src/sql/drivers/mysql/qsql_mysql.pri @@ -1,4 +1,4 @@ -HEADERS += $$PWD/qsql_mysql.h +HEADERS += $$PWD/qsql_mysql_p.h SOURCES += $$PWD/qsql_mysql.cpp !isEmpty(MYSQL_PATH) { diff --git a/src/sql/drivers/mysql/qsql_mysql_p.h b/src/sql/drivers/mysql/qsql_mysql_p.h new file mode 100644 index 0000000000..953216de9a --- /dev/null +++ b/src/sql/drivers/mysql/qsql_mysql_p.h @@ -0,0 +1,143 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_MYSQL_H +#define QSQL_MYSQL_H + +#include +#include + +#if defined (Q_OS_WIN32) +#include +#endif + +#include + +#ifdef QT_PLUGIN +#define Q_EXPORT_SQLDRIVER_MYSQL +#else +#define Q_EXPORT_SQLDRIVER_MYSQL Q_SQL_EXPORT +#endif + +QT_BEGIN_NAMESPACE + +#if 0 +#pragma qt_no_master_include +#pragma qt_sync_stop_processing +#endif + +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; +protected: + void cleanup(); + bool fetch(int i); + bool fetchNext(); + bool fetchLast(); + bool fetchFirst(); + QVariant data(int field); + bool isNull(int field); + bool reset (const QString& query); + int size(); + int numRowsAffected(); + QVariant lastInsertId() const; + QSqlRecord record() const; + void virtual_hook(int id, void *data); + bool nextResult(); + +#if MYSQL_VERSION_ID >= 40108 + bool prepare(const QString& stmt); + bool exec(); +#endif +private: + QMYSQLResultPrivate* d; +}; + +class Q_EXPORT_SQLDRIVER_MYSQL QMYSQLDriver : public QSqlDriver +{ + Q_OBJECT + friend class QMYSQLResult; +public: + explicit QMYSQLDriver(QObject *parent=0); + explicit QMYSQLDriver(MYSQL *con, QObject * parent=0); + ~QMYSQLDriver(); + bool hasFeature(DriverFeature f) const; + bool open(const QString & db, + const QString & user, + const QString & password, + const QString & host, + int port, + const QString& connOpts); + void close(); + QSqlResult *createResult() const; + QStringList tables(QSql::TableType) const; + QSqlIndex primaryIndex(const QString& tablename) const; + QSqlRecord record(const QString& tablename) const; + QString formatValue(const QSqlField &field, + bool trimStrings) const; + QVariant handle() const; + QString escapeIdentifier(const QString &identifier, IdentifierType type) const; + + bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const; + +protected: + bool beginTransaction(); + bool commitTransaction(); + bool rollbackTransaction(); +private: + void init(); + QMYSQLDriverPrivate* d; +}; + +QT_END_NAMESPACE + +#endif // QSQL_MYSQL_H diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index db73f8f6ea..8a6161d816 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qsql_oci.h" +#include "qsql_oci_p.h" #include #include diff --git a/src/sql/drivers/oci/qsql_oci.h b/src/sql/drivers/oci/qsql_oci.h deleted file mode 100644 index 403de623ce..0000000000 --- a/src/sql/drivers/oci/qsql_oci.h +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtSql module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSQL_OCI_H -#define QSQL_OCI_H - -#include -#include - -#ifdef QT_PLUGIN -#define Q_EXPORT_SQLDRIVER_OCI -#else -#define Q_EXPORT_SQLDRIVER_OCI Q_SQL_EXPORT -#endif - -typedef struct OCIEnv OCIEnv; -typedef struct OCISvcCtx OCISvcCtx; - -QT_BEGIN_NAMESPACE - -#if 0 -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - -class QOCIDriver; -class QOCICols; -struct QOCIDriverPrivate; - -class Q_EXPORT_SQLDRIVER_OCI QOCIDriver : public QSqlDriver -{ - Q_OBJECT - friend struct QOCIResultPrivate; - friend class QOCIPrivate; -public: - explicit QOCIDriver(QObject* parent = 0); - QOCIDriver(OCIEnv* env, OCISvcCtx* ctx, QObject* parent = 0); - ~QOCIDriver(); - bool hasFeature(DriverFeature f) const; - bool open(const QString & db, - const QString & user, - const QString & password, - const QString & host, - int port, - const QString& connOpts); - void close(); - QSqlResult *createResult() const; - QStringList tables(QSql::TableType) const; - QSqlRecord record(const QString& tablename) const; - QSqlIndex primaryIndex(const QString& tablename) const; - QString formatValue(const QSqlField &field, - bool trimStrings) const; - QVariant handle() const; - QString escapeIdentifier(const QString &identifier, IdentifierType) const; - -protected: - bool beginTransaction(); - bool commitTransaction(); - bool rollbackTransaction(); -private: - QOCIDriverPrivate *d; -}; - -QT_END_NAMESPACE - -#endif // QSQL_OCI_H diff --git a/src/sql/drivers/oci/qsql_oci.pri b/src/sql/drivers/oci/qsql_oci.pri index 60ccc4c227..9108dbaa3c 100644 --- a/src/sql/drivers/oci/qsql_oci.pri +++ b/src/sql/drivers/oci/qsql_oci.pri @@ -1,4 +1,4 @@ -HEADERS += $$PWD/qsql_oci.h +HEADERS += $$PWD/qsql_oci_p.h SOURCES += $$PWD/qsql_oci.cpp unix { diff --git a/src/sql/drivers/oci/qsql_oci_p.h b/src/sql/drivers/oci/qsql_oci_p.h new file mode 100644 index 0000000000..403de623ce --- /dev/null +++ b/src/sql/drivers/oci/qsql_oci_p.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_OCI_H +#define QSQL_OCI_H + +#include +#include + +#ifdef QT_PLUGIN +#define Q_EXPORT_SQLDRIVER_OCI +#else +#define Q_EXPORT_SQLDRIVER_OCI Q_SQL_EXPORT +#endif + +typedef struct OCIEnv OCIEnv; +typedef struct OCISvcCtx OCISvcCtx; + +QT_BEGIN_NAMESPACE + +#if 0 +#pragma qt_no_master_include +#pragma qt_sync_stop_processing +#endif + +class QOCIDriver; +class QOCICols; +struct QOCIDriverPrivate; + +class Q_EXPORT_SQLDRIVER_OCI QOCIDriver : public QSqlDriver +{ + Q_OBJECT + friend struct QOCIResultPrivate; + friend class QOCIPrivate; +public: + explicit QOCIDriver(QObject* parent = 0); + QOCIDriver(OCIEnv* env, OCISvcCtx* ctx, QObject* parent = 0); + ~QOCIDriver(); + bool hasFeature(DriverFeature f) const; + bool open(const QString & db, + const QString & user, + const QString & password, + const QString & host, + int port, + const QString& connOpts); + void close(); + QSqlResult *createResult() const; + QStringList tables(QSql::TableType) const; + QSqlRecord record(const QString& tablename) const; + QSqlIndex primaryIndex(const QString& tablename) const; + QString formatValue(const QSqlField &field, + bool trimStrings) const; + QVariant handle() const; + QString escapeIdentifier(const QString &identifier, IdentifierType) const; + +protected: + bool beginTransaction(); + bool commitTransaction(); + bool rollbackTransaction(); +private: + QOCIDriverPrivate *d; +}; + +QT_END_NAMESPACE + +#endif // QSQL_OCI_H diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 9517d95fc4..a52e3ee451 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qsql_odbc.h" +#include "qsql_odbc_p.h" #include #if defined (Q_OS_WIN32) diff --git a/src/sql/drivers/odbc/qsql_odbc.h b/src/sql/drivers/odbc/qsql_odbc.h deleted file mode 100644 index 26f47e6c74..0000000000 --- a/src/sql/drivers/odbc/qsql_odbc.h +++ /dev/null @@ -1,159 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtSql module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSQL_ODBC_H -#define QSQL_ODBC_H - -#include -#include - -#if defined (Q_OS_WIN32) -#include -#endif - -#ifdef QT_PLUGIN -#define Q_EXPORT_SQLDRIVER_ODBC -#else -#define Q_EXPORT_SQLDRIVER_ODBC Q_SQL_EXPORT -#endif - -#ifdef Q_OS_UNIX -#define HAVE_LONG_LONG 1 // force UnixODBC NOT to fall back to a struct for BIGINTs -#endif - -#if defined(Q_CC_BOR) -// workaround for Borland to make sure that SQLBIGINT is defined -# define _MSC_VER 900 -#endif -#include -#if defined(Q_CC_BOR) -# undef _MSC_VER -#endif - -#include - -QT_BEGIN_NAMESPACE - -#if 0 -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - -class QODBCPrivate; -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 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: - QODBCPrivate *d; -}; - -class Q_EXPORT_SQLDRIVER_ODBC QODBCDriver : public QSqlDriver -{ - Q_OBJECT -public: - explicit QODBCDriver(QObject *parent=0); - QODBCDriver(SQLHANDLE env, SQLHANDLE con, QObject * parent=0); - virtual ~QODBCDriver(); - bool hasFeature(DriverFeature f) const; - void close(); - QSqlResult *createResult() const; - QStringList tables(QSql::TableType) const; - QSqlRecord record(const QString& tablename) const; - QSqlIndex primaryIndex(const QString& tablename) const; - QVariant handle() const; - QString formatValue(const QSqlField &field, - bool trimStrings) const; - bool open(const QString& db, - const QString& user, - const QString& password, - const QString& host, - int port, - const QString& connOpts); - - QString escapeIdentifier(const QString &identifier, IdentifierType type) const; - - bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const; - -protected: - bool beginTransaction(); - bool commitTransaction(); - bool rollbackTransaction(); - -private: - void init(); - bool endTrans(); - void cleanup(); - QODBCDriverPrivate* d; - friend class QODBCPrivate; -}; - -QT_END_NAMESPACE - -#endif // QSQL_ODBC_H diff --git a/src/sql/drivers/odbc/qsql_odbc.pri b/src/sql/drivers/odbc/qsql_odbc.pri index 19ff784a04..b206df37c3 100644 --- a/src/sql/drivers/odbc/qsql_odbc.pri +++ b/src/sql/drivers/odbc/qsql_odbc.pri @@ -1,4 +1,4 @@ -HEADERS += $$PWD/qsql_odbc.h +HEADERS += $$PWD/qsql_odbc_p.h SOURCES += $$PWD/qsql_odbc.cpp unix { diff --git a/src/sql/drivers/odbc/qsql_odbc_p.h b/src/sql/drivers/odbc/qsql_odbc_p.h new file mode 100644 index 0000000000..26f47e6c74 --- /dev/null +++ b/src/sql/drivers/odbc/qsql_odbc_p.h @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_ODBC_H +#define QSQL_ODBC_H + +#include +#include + +#if defined (Q_OS_WIN32) +#include +#endif + +#ifdef QT_PLUGIN +#define Q_EXPORT_SQLDRIVER_ODBC +#else +#define Q_EXPORT_SQLDRIVER_ODBC Q_SQL_EXPORT +#endif + +#ifdef Q_OS_UNIX +#define HAVE_LONG_LONG 1 // force UnixODBC NOT to fall back to a struct for BIGINTs +#endif + +#if defined(Q_CC_BOR) +// workaround for Borland to make sure that SQLBIGINT is defined +# define _MSC_VER 900 +#endif +#include +#if defined(Q_CC_BOR) +# undef _MSC_VER +#endif + +#include + +QT_BEGIN_NAMESPACE + +#if 0 +#pragma qt_no_master_include +#pragma qt_sync_stop_processing +#endif + +class QODBCPrivate; +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 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: + QODBCPrivate *d; +}; + +class Q_EXPORT_SQLDRIVER_ODBC QODBCDriver : public QSqlDriver +{ + Q_OBJECT +public: + explicit QODBCDriver(QObject *parent=0); + QODBCDriver(SQLHANDLE env, SQLHANDLE con, QObject * parent=0); + virtual ~QODBCDriver(); + bool hasFeature(DriverFeature f) const; + void close(); + QSqlResult *createResult() const; + QStringList tables(QSql::TableType) const; + QSqlRecord record(const QString& tablename) const; + QSqlIndex primaryIndex(const QString& tablename) const; + QVariant handle() const; + QString formatValue(const QSqlField &field, + bool trimStrings) const; + bool open(const QString& db, + const QString& user, + const QString& password, + const QString& host, + int port, + const QString& connOpts); + + QString escapeIdentifier(const QString &identifier, IdentifierType type) const; + + bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const; + +protected: + bool beginTransaction(); + bool commitTransaction(); + bool rollbackTransaction(); + +private: + void init(); + bool endTrans(); + void cleanup(); + QODBCDriverPrivate* d; + friend class QODBCPrivate; +}; + +QT_END_NAMESPACE + +#endif // QSQL_ODBC_H diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 0eadceb1d1..95fcba4172 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qsql_psql.h" +#include "qsql_psql_p.h" #include #include diff --git a/src/sql/drivers/psql/qsql_psql.h b/src/sql/drivers/psql/qsql_psql.h deleted file mode 100644 index d5585a45fa..0000000000 --- a/src/sql/drivers/psql/qsql_psql.h +++ /dev/null @@ -1,159 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtSql module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSQL_PSQL_H -#define QSQL_PSQL_H - -#include -#include - -#ifdef QT_PLUGIN -#define Q_EXPORT_SQLDRIVER_PSQL -#else -#define Q_EXPORT_SQLDRIVER_PSQL Q_SQL_EXPORT -#endif - -typedef struct pg_conn PGconn; -typedef struct pg_result PGresult; - -QT_BEGIN_NAMESPACE - -#if 0 -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - -class QPSQLResultPrivate; -class QPSQLDriverPrivate; -class QPSQLDriver; -class QSqlRecordInfo; - -class QPSQLResult : public QSqlResult -{ - friend class QPSQLResultPrivate; -public: - QPSQLResult(const QPSQLDriver* db, const QPSQLDriverPrivate* p); - ~QPSQLResult(); - - QVariant handle() const; - void virtual_hook(int id, void *data); - -protected: - void cleanup(); - bool fetch(int i); - bool fetchFirst(); - bool fetchLast(); - QVariant data(int i); - bool isNull(int field); - bool reset (const QString& query); - int size(); - int numRowsAffected(); - QSqlRecord record() const; - QVariant lastInsertId() const; - bool prepare(const QString& query); - bool exec(); - -private: - QPSQLResultPrivate *d; -}; - -class Q_EXPORT_SQLDRIVER_PSQL QPSQLDriver : public QSqlDriver -{ - Q_OBJECT -public: - enum Protocol { - VersionUnknown = -1, - Version6 = 6, - Version7 = 7, - Version71 = 8, - Version73 = 9, - Version74 = 10, - Version8 = 11, - Version81 = 12, - Version82 = 13, - Version83 = 14, - Version84 = 15, - Version9 = 16, - }; - - explicit QPSQLDriver(QObject *parent=0); - explicit QPSQLDriver(PGconn *conn, QObject *parent=0); - ~QPSQLDriver(); - bool hasFeature(DriverFeature f) const; - bool open(const QString & db, - const QString & user, - const QString & password, - const QString & host, - int port, - const QString& connOpts); - bool isOpen() const; - void close(); - QSqlResult *createResult() const; - QStringList tables(QSql::TableType) const; - QSqlIndex primaryIndex(const QString& tablename) const; - QSqlRecord record(const QString& tablename) const; - - Protocol protocol() const; - QVariant handle() const; - - QString escapeIdentifier(const QString &identifier, IdentifierType type) const; - QString formatValue(const QSqlField &field, bool trimStrings) const; - - bool subscribeToNotification(const QString &name); - bool unsubscribeFromNotification(const QString &name); - QStringList subscribedToNotifications() const; - -protected: - bool beginTransaction(); - bool commitTransaction(); - bool rollbackTransaction(); - -private Q_SLOTS: - void _q_handleNotification(int); - -private: - void init(); - QPSQLDriverPrivate *d; -}; - -QT_END_NAMESPACE - -#endif // QSQL_PSQL_H diff --git a/src/sql/drivers/psql/qsql_psql.pri b/src/sql/drivers/psql/qsql_psql.pri index 9b647d8200..d0ded5e625 100644 --- a/src/sql/drivers/psql/qsql_psql.pri +++ b/src/sql/drivers/psql/qsql_psql.pri @@ -1,4 +1,4 @@ -HEADERS += $$PWD/qsql_psql.h +HEADERS += $$PWD/qsql_psql_p.h SOURCES += $$PWD/qsql_psql.cpp unix|win32-g++* { diff --git a/src/sql/drivers/psql/qsql_psql_p.h b/src/sql/drivers/psql/qsql_psql_p.h new file mode 100644 index 0000000000..d5585a45fa --- /dev/null +++ b/src/sql/drivers/psql/qsql_psql_p.h @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_PSQL_H +#define QSQL_PSQL_H + +#include +#include + +#ifdef QT_PLUGIN +#define Q_EXPORT_SQLDRIVER_PSQL +#else +#define Q_EXPORT_SQLDRIVER_PSQL Q_SQL_EXPORT +#endif + +typedef struct pg_conn PGconn; +typedef struct pg_result PGresult; + +QT_BEGIN_NAMESPACE + +#if 0 +#pragma qt_no_master_include +#pragma qt_sync_stop_processing +#endif + +class QPSQLResultPrivate; +class QPSQLDriverPrivate; +class QPSQLDriver; +class QSqlRecordInfo; + +class QPSQLResult : public QSqlResult +{ + friend class QPSQLResultPrivate; +public: + QPSQLResult(const QPSQLDriver* db, const QPSQLDriverPrivate* p); + ~QPSQLResult(); + + QVariant handle() const; + void virtual_hook(int id, void *data); + +protected: + void cleanup(); + bool fetch(int i); + bool fetchFirst(); + bool fetchLast(); + QVariant data(int i); + bool isNull(int field); + bool reset (const QString& query); + int size(); + int numRowsAffected(); + QSqlRecord record() const; + QVariant lastInsertId() const; + bool prepare(const QString& query); + bool exec(); + +private: + QPSQLResultPrivate *d; +}; + +class Q_EXPORT_SQLDRIVER_PSQL QPSQLDriver : public QSqlDriver +{ + Q_OBJECT +public: + enum Protocol { + VersionUnknown = -1, + Version6 = 6, + Version7 = 7, + Version71 = 8, + Version73 = 9, + Version74 = 10, + Version8 = 11, + Version81 = 12, + Version82 = 13, + Version83 = 14, + Version84 = 15, + Version9 = 16, + }; + + explicit QPSQLDriver(QObject *parent=0); + explicit QPSQLDriver(PGconn *conn, QObject *parent=0); + ~QPSQLDriver(); + bool hasFeature(DriverFeature f) const; + bool open(const QString & db, + const QString & user, + const QString & password, + const QString & host, + int port, + const QString& connOpts); + bool isOpen() const; + void close(); + QSqlResult *createResult() const; + QStringList tables(QSql::TableType) const; + QSqlIndex primaryIndex(const QString& tablename) const; + QSqlRecord record(const QString& tablename) const; + + Protocol protocol() const; + QVariant handle() const; + + QString escapeIdentifier(const QString &identifier, IdentifierType type) const; + QString formatValue(const QSqlField &field, bool trimStrings) const; + + bool subscribeToNotification(const QString &name); + bool unsubscribeFromNotification(const QString &name); + QStringList subscribedToNotifications() const; + +protected: + bool beginTransaction(); + bool commitTransaction(); + bool rollbackTransaction(); + +private Q_SLOTS: + void _q_handleNotification(int); + +private: + void init(); + QPSQLDriverPrivate *d; +}; + +QT_END_NAMESPACE + +#endif // QSQL_PSQL_H diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index d884bb7b11..483c640b43 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qsql_sqlite.h" +#include "qsql_sqlite_p.h" #include #include diff --git a/src/sql/drivers/sqlite/qsql_sqlite.h b/src/sql/drivers/sqlite/qsql_sqlite.h deleted file mode 100644 index bd034b4d6b..0000000000 --- a/src/sql/drivers/sqlite/qsql_sqlite.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtSql module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSQL_SQLITE_H -#define QSQL_SQLITE_H - -#include -#include - -struct sqlite3; - -#ifdef QT_PLUGIN -#define Q_EXPORT_SQLDRIVER_SQLITE -#else -#define Q_EXPORT_SQLDRIVER_SQLITE Q_SQL_EXPORT -#endif - -QT_BEGIN_NAMESPACE - -#if 0 -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - -class QSQLiteDriverPrivate; -class QSQLiteDriver; - -class Q_EXPORT_SQLDRIVER_SQLITE QSQLiteDriver : public QSqlDriver -{ - Q_OBJECT - friend class QSQLiteResult; -public: - explicit QSQLiteDriver(QObject *parent = 0); - explicit QSQLiteDriver(sqlite3 *connection, QObject *parent = 0); - ~QSQLiteDriver(); - bool hasFeature(DriverFeature f) const; - bool open(const QString & db, - const QString & user, - const QString & password, - const QString & host, - int port, - const QString & connOpts); - void close(); - QSqlResult *createResult() const; - bool beginTransaction(); - bool commitTransaction(); - bool rollbackTransaction(); - QStringList tables(QSql::TableType) const; - - QSqlRecord record(const QString& tablename) const; - QSqlIndex primaryIndex(const QString &table) const; - QVariant handle() const; - QString escapeIdentifier(const QString &identifier, IdentifierType) const; - -private: - QSQLiteDriverPrivate* d; -}; - -QT_END_NAMESPACE - -#endif // QSQL_SQLITE_H diff --git a/src/sql/drivers/sqlite/qsql_sqlite.pri b/src/sql/drivers/sqlite/qsql_sqlite.pri index a2e80d4c74..e323f2eba5 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.pri +++ b/src/sql/drivers/sqlite/qsql_sqlite.pri @@ -1,4 +1,4 @@ -HEADERS += $$PWD/qsql_sqlite.h +HEADERS += $$PWD/qsql_sqlite_p.h SOURCES += $$PWD/qsql_sqlite.cpp !system-sqlite:!contains(LIBS, .*sqlite3.*) { diff --git a/src/sql/drivers/sqlite/qsql_sqlite_p.h b/src/sql/drivers/sqlite/qsql_sqlite_p.h new file mode 100644 index 0000000000..bd034b4d6b --- /dev/null +++ b/src/sql/drivers/sqlite/qsql_sqlite_p.h @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_SQLITE_H +#define QSQL_SQLITE_H + +#include +#include + +struct sqlite3; + +#ifdef QT_PLUGIN +#define Q_EXPORT_SQLDRIVER_SQLITE +#else +#define Q_EXPORT_SQLDRIVER_SQLITE Q_SQL_EXPORT +#endif + +QT_BEGIN_NAMESPACE + +#if 0 +#pragma qt_no_master_include +#pragma qt_sync_stop_processing +#endif + +class QSQLiteDriverPrivate; +class QSQLiteDriver; + +class Q_EXPORT_SQLDRIVER_SQLITE QSQLiteDriver : public QSqlDriver +{ + Q_OBJECT + friend class QSQLiteResult; +public: + explicit QSQLiteDriver(QObject *parent = 0); + explicit QSQLiteDriver(sqlite3 *connection, QObject *parent = 0); + ~QSQLiteDriver(); + bool hasFeature(DriverFeature f) const; + bool open(const QString & db, + const QString & user, + const QString & password, + const QString & host, + int port, + const QString & connOpts); + void close(); + QSqlResult *createResult() const; + bool beginTransaction(); + bool commitTransaction(); + bool rollbackTransaction(); + QStringList tables(QSql::TableType) const; + + QSqlRecord record(const QString& tablename) const; + QSqlIndex primaryIndex(const QString &table) const; + QVariant handle() const; + QString escapeIdentifier(const QString &identifier, IdentifierType) const; + +private: + QSQLiteDriverPrivate* d; +}; + +QT_END_NAMESPACE + +#endif // QSQL_SQLITE_H diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp index 2666cefb72..a85a120973 100644 --- a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp +++ b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qsql_sqlite2.h" +#include "qsql_sqlite2_p.h" #include #include diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.h b/src/sql/drivers/sqlite2/qsql_sqlite2.h deleted file mode 100644 index c6a8c4cf4f..0000000000 --- a/src/sql/drivers/sqlite2/qsql_sqlite2.h +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtSql module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSQL_SQLITE2_H -#define QSQL_SQLITE2_H - -#include -#include -#include -#include - -#if defined (Q_OS_WIN32) -# include -#endif - -struct sqlite; - -QT_BEGIN_NAMESPACE - -#if 0 -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - -class QSQLite2DriverPrivate; -class QSQLite2Driver; - -class QSQLite2Driver : public QSqlDriver -{ - Q_OBJECT - friend class QSQLite2Result; -public: - explicit QSQLite2Driver(QObject *parent = 0); - explicit QSQLite2Driver(sqlite *connection, QObject *parent = 0); - ~QSQLite2Driver(); - bool hasFeature(DriverFeature f) const; - bool open(const QString & db, - const QString & user, - const QString & password, - const QString & host, - int port, - const QString & connOpts); - bool open(const QString & db, - const QString & user, - const QString & password, - const QString & host, - int port) { return open (db, user, password, host, port, QString()); } - void close(); - QSqlResult *createResult() const; - bool beginTransaction(); - bool commitTransaction(); - bool rollbackTransaction(); - QStringList tables(QSql::TableType) const; - - QSqlRecord record(const QString& tablename) const; - QSqlIndex primaryIndex(const QString &table) const; - QVariant handle() const; - QString escapeIdentifier(const QString &identifier, IdentifierType) const; - -private: - QSQLite2DriverPrivate* d; -}; - -QT_END_NAMESPACE - -#endif // QSQL_SQLITE2_H diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.pri b/src/sql/drivers/sqlite2/qsql_sqlite2.pri index 9a9f6cdf9e..5baba30db0 100644 --- a/src/sql/drivers/sqlite2/qsql_sqlite2.pri +++ b/src/sql/drivers/sqlite2/qsql_sqlite2.pri @@ -1,4 +1,4 @@ -HEADERS += $$PWD/qsql_sqlite2.h +HEADERS += $$PWD/qsql_sqlite2_p.h SOURCES += $$PWD/qsql_sqlite2.cpp !contains(LIBS, .*sqlite.*):LIBS += -lsqlite diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2_p.h b/src/sql/drivers/sqlite2/qsql_sqlite2_p.h new file mode 100644 index 0000000000..c6a8c4cf4f --- /dev/null +++ b/src/sql/drivers/sqlite2/qsql_sqlite2_p.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_SQLITE2_H +#define QSQL_SQLITE2_H + +#include +#include +#include +#include + +#if defined (Q_OS_WIN32) +# include +#endif + +struct sqlite; + +QT_BEGIN_NAMESPACE + +#if 0 +#pragma qt_no_master_include +#pragma qt_sync_stop_processing +#endif + +class QSQLite2DriverPrivate; +class QSQLite2Driver; + +class QSQLite2Driver : public QSqlDriver +{ + Q_OBJECT + friend class QSQLite2Result; +public: + explicit QSQLite2Driver(QObject *parent = 0); + explicit QSQLite2Driver(sqlite *connection, QObject *parent = 0); + ~QSQLite2Driver(); + bool hasFeature(DriverFeature f) const; + bool open(const QString & db, + const QString & user, + const QString & password, + const QString & host, + int port, + const QString & connOpts); + bool open(const QString & db, + const QString & user, + const QString & password, + const QString & host, + int port) { return open (db, user, password, host, port, QString()); } + void close(); + QSqlResult *createResult() const; + bool beginTransaction(); + bool commitTransaction(); + bool rollbackTransaction(); + QStringList tables(QSql::TableType) const; + + QSqlRecord record(const QString& tablename) const; + QSqlIndex primaryIndex(const QString &table) const; + QVariant handle() const; + QString escapeIdentifier(const QString &identifier, IdentifierType) const; + +private: + QSQLite2DriverPrivate* d; +}; + +QT_END_NAMESPACE + +#endif // QSQL_SQLITE2_H diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/sql/drivers/tds/qsql_tds.cpp index 22773b8eff..996a1bdd1a 100644 --- a/src/sql/drivers/tds/qsql_tds.cpp +++ b/src/sql/drivers/tds/qsql_tds.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qsql_tds.h" +#include "qsql_tds_p.h" #include #ifdef Q_OS_WIN32 // We assume that MS SQL Server is used. Set Q_USE_SYBASE to force Sybase. diff --git a/src/sql/drivers/tds/qsql_tds.h b/src/sql/drivers/tds/qsql_tds.h deleted file mode 100644 index 2bbdd0e49c..0000000000 --- a/src/sql/drivers/tds/qsql_tds.h +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtSql module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSQL_TDS_H -#define QSQL_TDS_H - -#include -#include - -#ifdef Q_OS_WIN32 -#define WIN32_LEAN_AND_MEAN -#ifndef Q_USE_SYBASE -#define DBNTWIN32 // indicates 32bit windows dblib -#endif -#include -#include -#include -#include -#define CS_PUBLIC -#else -#include -#include -#endif //Q_OS_WIN32 - -#ifdef QT_PLUGIN -#define Q_EXPORT_SQLDRIVER_TDS -#else -#define Q_EXPORT_SQLDRIVER_TDS Q_SQL_EXPORT -#endif - -QT_BEGIN_NAMESPACE - -#if 0 -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - -class QTDSDriverPrivate; -class QTDSDriver; - -class Q_EXPORT_SQLDRIVER_TDS QTDSDriver : public QSqlDriver -{ - Q_OBJECT - friend class QTDSResult; -public: - explicit QTDSDriver(QObject* parent = 0); - QTDSDriver(LOGINREC* rec, const QString& host, const QString &db, QObject* parent = 0); - ~QTDSDriver(); - bool hasFeature(DriverFeature f) const; - bool open(const QString & db, - const QString & user, - const QString & password, - const QString & host, - int port, - const QString& connOpts); - void close(); - QStringList tables(QSql::TableType) const; - QSqlResult *createResult() const; - QSqlRecord record(const QString& tablename) const; - QSqlIndex primaryIndex(const QString& tablename) const; - - QString formatValue(const QSqlField &field, - bool trimStrings) const; - QVariant handle() const; - - QString escapeIdentifier(const QString &identifier, IdentifierType type) const; - -protected: - bool beginTransaction(); - bool commitTransaction(); - bool rollbackTransaction(); -private: - void init(); - QTDSDriverPrivate *d; -}; - -QT_END_NAMESPACE - -#endif // QSQL_TDS_H diff --git a/src/sql/drivers/tds/qsql_tds.pri b/src/sql/drivers/tds/qsql_tds.pri index 38aab2f3e4..67d037aa6b 100644 --- a/src/sql/drivers/tds/qsql_tds.pri +++ b/src/sql/drivers/tds/qsql_tds.pri @@ -1,4 +1,4 @@ -HEADERS += $$PWD/qsql_tds.h +HEADERS += $$PWD/qsql_tds_p.h SOURCES += $$PWD/qsql_tds.cpp unix|win32-g++*: { diff --git a/src/sql/drivers/tds/qsql_tds_p.h b/src/sql/drivers/tds/qsql_tds_p.h new file mode 100644 index 0000000000..2bbdd0e49c --- /dev/null +++ b/src/sql/drivers/tds/qsql_tds_p.h @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtSql module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSQL_TDS_H +#define QSQL_TDS_H + +#include +#include + +#ifdef Q_OS_WIN32 +#define WIN32_LEAN_AND_MEAN +#ifndef Q_USE_SYBASE +#define DBNTWIN32 // indicates 32bit windows dblib +#endif +#include +#include +#include +#include +#define CS_PUBLIC +#else +#include +#include +#endif //Q_OS_WIN32 + +#ifdef QT_PLUGIN +#define Q_EXPORT_SQLDRIVER_TDS +#else +#define Q_EXPORT_SQLDRIVER_TDS Q_SQL_EXPORT +#endif + +QT_BEGIN_NAMESPACE + +#if 0 +#pragma qt_no_master_include +#pragma qt_sync_stop_processing +#endif + +class QTDSDriverPrivate; +class QTDSDriver; + +class Q_EXPORT_SQLDRIVER_TDS QTDSDriver : public QSqlDriver +{ + Q_OBJECT + friend class QTDSResult; +public: + explicit QTDSDriver(QObject* parent = 0); + QTDSDriver(LOGINREC* rec, const QString& host, const QString &db, QObject* parent = 0); + ~QTDSDriver(); + bool hasFeature(DriverFeature f) const; + bool open(const QString & db, + const QString & user, + const QString & password, + const QString & host, + int port, + const QString& connOpts); + void close(); + QStringList tables(QSql::TableType) const; + QSqlResult *createResult() const; + QSqlRecord record(const QString& tablename) const; + QSqlIndex primaryIndex(const QString& tablename) const; + + QString formatValue(const QSqlField &field, + bool trimStrings) const; + QVariant handle() const; + + QString escapeIdentifier(const QString &identifier, IdentifierType type) const; + +protected: + bool beginTransaction(); + bool commitTransaction(); + bool rollbackTransaction(); +private: + void init(); + QTDSDriverPrivate *d; +}; + +QT_END_NAMESPACE + +#endif // QSQL_TDS_H -- cgit v1.2.3 From 932c50c015fe416354b08cea50581fa5fdfee86e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 22 Feb 2013 14:01:41 -0800 Subject: Adapt the newly-renamed SQL driver headers to proper private headers Add the "We mean it" text and remove the now-unnecessary syncqt macros that used to prevent those headers from being added to the master includes. Change-Id: I03ac2a452bc6ac43ebba502bc0ecbf5ee1adf314 Reviewed-by: Friedemann Kleint Reviewed-by: Mark Brand --- src/sql/drivers/db2/qsql_db2_p.h | 16 +++++++++++----- src/sql/drivers/ibase/qsql_ibase_p.h | 16 +++++++++++----- src/sql/drivers/mysql/qsql_mysql_p.h | 16 +++++++++++----- src/sql/drivers/oci/qsql_oci_p.h | 16 +++++++++++----- src/sql/drivers/odbc/qsql_odbc_p.h | 16 +++++++++++----- src/sql/drivers/psql/qsql_psql_p.h | 16 +++++++++++----- src/sql/drivers/sqlite/qsql_sqlite_p.h | 16 +++++++++++----- src/sql/drivers/sqlite2/qsql_sqlite2_p.h | 16 +++++++++++----- src/sql/drivers/tds/qsql_tds_p.h | 16 +++++++++++----- 9 files changed, 99 insertions(+), 45 deletions(-) (limited to 'src/sql/drivers') diff --git a/src/sql/drivers/db2/qsql_db2_p.h b/src/sql/drivers/db2/qsql_db2_p.h index 5d31906096..6a5363740b 100644 --- a/src/sql/drivers/db2/qsql_db2_p.h +++ b/src/sql/drivers/db2/qsql_db2_p.h @@ -42,6 +42,17 @@ #ifndef QSQL_DB2_H #define QSQL_DB2_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #ifdef QT_PLUGIN #define Q_EXPORT_SQLDRIVER_DB2 #else @@ -53,11 +64,6 @@ QT_BEGIN_NAMESPACE -#if 0 -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - class QDB2Driver; class QDB2DriverPrivate; class QDB2ResultPrivate; diff --git a/src/sql/drivers/ibase/qsql_ibase_p.h b/src/sql/drivers/ibase/qsql_ibase_p.h index 781448b98a..b2560ca17c 100644 --- a/src/sql/drivers/ibase/qsql_ibase_p.h +++ b/src/sql/drivers/ibase/qsql_ibase_p.h @@ -42,17 +42,23 @@ #ifndef QSQL_IBASE_H #define QSQL_IBASE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include QT_BEGIN_NAMESPACE -#if 0 -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - class QIBaseDriverPrivate; class QIBaseDriver; diff --git a/src/sql/drivers/mysql/qsql_mysql_p.h b/src/sql/drivers/mysql/qsql_mysql_p.h index 953216de9a..c23bcd92d7 100644 --- a/src/sql/drivers/mysql/qsql_mysql_p.h +++ b/src/sql/drivers/mysql/qsql_mysql_p.h @@ -42,6 +42,17 @@ #ifndef QSQL_MYSQL_H #define QSQL_MYSQL_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include @@ -59,11 +70,6 @@ QT_BEGIN_NAMESPACE -#if 0 -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - class QMYSQLDriverPrivate; class QMYSQLResultPrivate; class QMYSQLDriver; diff --git a/src/sql/drivers/oci/qsql_oci_p.h b/src/sql/drivers/oci/qsql_oci_p.h index 403de623ce..fecc828434 100644 --- a/src/sql/drivers/oci/qsql_oci_p.h +++ b/src/sql/drivers/oci/qsql_oci_p.h @@ -42,6 +42,17 @@ #ifndef QSQL_OCI_H #define QSQL_OCI_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include @@ -56,11 +67,6 @@ typedef struct OCISvcCtx OCISvcCtx; QT_BEGIN_NAMESPACE -#if 0 -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - class QOCIDriver; class QOCICols; struct QOCIDriverPrivate; diff --git a/src/sql/drivers/odbc/qsql_odbc_p.h b/src/sql/drivers/odbc/qsql_odbc_p.h index 26f47e6c74..c1367165f5 100644 --- a/src/sql/drivers/odbc/qsql_odbc_p.h +++ b/src/sql/drivers/odbc/qsql_odbc_p.h @@ -42,6 +42,17 @@ #ifndef QSQL_ODBC_H #define QSQL_ODBC_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include @@ -72,11 +83,6 @@ QT_BEGIN_NAMESPACE -#if 0 -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - class QODBCPrivate; class QODBCDriverPrivate; class QODBCDriver; diff --git a/src/sql/drivers/psql/qsql_psql_p.h b/src/sql/drivers/psql/qsql_psql_p.h index d5585a45fa..6f60a2a34f 100644 --- a/src/sql/drivers/psql/qsql_psql_p.h +++ b/src/sql/drivers/psql/qsql_psql_p.h @@ -42,6 +42,17 @@ #ifndef QSQL_PSQL_H #define QSQL_PSQL_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include @@ -56,11 +67,6 @@ typedef struct pg_result PGresult; QT_BEGIN_NAMESPACE -#if 0 -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - class QPSQLResultPrivate; class QPSQLDriverPrivate; class QPSQLDriver; diff --git a/src/sql/drivers/sqlite/qsql_sqlite_p.h b/src/sql/drivers/sqlite/qsql_sqlite_p.h index bd034b4d6b..548d1da97c 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite_p.h +++ b/src/sql/drivers/sqlite/qsql_sqlite_p.h @@ -42,6 +42,17 @@ #ifndef QSQL_SQLITE_H #define QSQL_SQLITE_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include @@ -55,11 +66,6 @@ struct sqlite3; QT_BEGIN_NAMESPACE -#if 0 -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - class QSQLiteDriverPrivate; class QSQLiteDriver; diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2_p.h b/src/sql/drivers/sqlite2/qsql_sqlite2_p.h index c6a8c4cf4f..7a075210ae 100644 --- a/src/sql/drivers/sqlite2/qsql_sqlite2_p.h +++ b/src/sql/drivers/sqlite2/qsql_sqlite2_p.h @@ -42,6 +42,17 @@ #ifndef QSQL_SQLITE2_H #define QSQL_SQLITE2_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include #include @@ -55,11 +66,6 @@ struct sqlite; QT_BEGIN_NAMESPACE -#if 0 -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - class QSQLite2DriverPrivate; class QSQLite2Driver; diff --git a/src/sql/drivers/tds/qsql_tds_p.h b/src/sql/drivers/tds/qsql_tds_p.h index 2bbdd0e49c..5336f183ef 100644 --- a/src/sql/drivers/tds/qsql_tds_p.h +++ b/src/sql/drivers/tds/qsql_tds_p.h @@ -42,6 +42,17 @@ #ifndef QSQL_TDS_H #define QSQL_TDS_H +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + #include #include @@ -68,11 +79,6 @@ QT_BEGIN_NAMESPACE -#if 0 -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - class QTDSDriverPrivate; class QTDSDriver; -- cgit v1.2.3 From ad211acae45f64f7cc604e41fbe6261c8a60af95 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Sun, 10 Feb 2013 21:46:25 +0100 Subject: qpsql: simplify expression Change-Id: I1cff816ca5e8f683015186a2b5815e564ad454e6 Reviewed-by: Andy Shaw --- src/sql/drivers/psql/qsql_psql.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sql/drivers') diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 95fcba4172..3cea46a7e2 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -585,7 +585,7 @@ bool QPSQLResult::exec() cleanup(); QString stmt; - const QString params = qCreateParamString(boundValues(), d->q->driver()); + const QString params = qCreateParamString(boundValues(), driver()); if (params.isEmpty()) stmt = QString::fromLatin1("EXECUTE %1").arg(d->preparedStmtId); else -- cgit v1.2.3 From 63b180d390f7accb8e3c72681a5c20ccaf15803a Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Sun, 10 Feb 2013 22:35:13 +0100 Subject: rename private driver to privDriver This avoids confusion now with the actual driver and avoids a name collision in later refactoring. Change-Id: I83055213f3a7b7998640662d49ba33749fdadd18 Reviewed-by: Andy Shaw --- src/sql/drivers/psql/qsql_psql.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/sql/drivers') diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 3cea46a7e2..332f7f7ed2 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -183,11 +183,11 @@ PGresult * QPSQLDriverPrivate::exec(const QString & stmt) const class QPSQLResultPrivate { public: - QPSQLResultPrivate(QPSQLResult *qq): q(qq), driver(0), result(0), currentSize(-1), preparedQueriesEnabled(false) {} + QPSQLResultPrivate(QPSQLResult *qq): q(qq), privDriver(0), result(0), currentSize(-1), preparedQueriesEnabled(false) {} static QString fieldSerial(int i) { return QLatin1Char('$') + QString::number(i + 1); } QPSQLResult *q; - const QPSQLDriverPrivate *driver; + const QPSQLDriverPrivate *privDriver; PGresult *result; int currentSize; bool preparedQueriesEnabled; @@ -226,7 +226,7 @@ bool QPSQLResultPrivate::processResults() return true; } q->setLastError(qMakeError(QCoreApplication::translate("QPSQLResult", - "Unable to create query"), QSqlError::StatementError, driver, result)); + "Unable to create query"), QSqlError::StatementError, privDriver, result)); return false; } @@ -279,10 +279,10 @@ static QVariant::Type qDecodePSQLType(int t) static void qDeallocatePreparedStmt(QPSQLResultPrivate *d) { const QString stmt = QLatin1String("DEALLOCATE ") + d->preparedStmtId; - PGresult *result = d->driver->exec(stmt); + PGresult *result = d->privDriver->exec(stmt); if (PQresultStatus(result) != PGRES_COMMAND_OK) - qWarning("Unable to free statement: %s", PQerrorMessage(d->driver->connection)); + qWarning("Unable to free statement: %s", PQerrorMessage(d->privDriver->connection)); PQclear(result); d->preparedStmtId.clear(); } @@ -291,7 +291,7 @@ QPSQLResult::QPSQLResult(const QPSQLDriver* db, const QPSQLDriverPrivate* p) : QSqlResult(db) { d = new QPSQLResultPrivate(this); - d->driver = p; + d->privDriver = p; d->preparedQueriesEnabled = db->hasFeature(QSqlDriver::PreparedQueries); } @@ -359,7 +359,7 @@ QVariant QPSQLResult::data(int i) case QVariant::Bool: return QVariant((bool)(val[0] == 't')); case QVariant::String: - return d->driver->isUtf8 ? QString::fromUtf8(val) : QString::fromLatin1(val); + return d->privDriver->isUtf8 ? QString::fromUtf8(val) : QString::fromLatin1(val); case QVariant::LongLong: if (val[0] == '-') return QString::fromLatin1(val).toLongLong(); @@ -457,7 +457,7 @@ bool QPSQLResult::reset (const QString& query) return false; if (!driver()->isOpen() || driver()->isOpenError()) return false; - d->result = d->driver->exec(query); + d->result = d->privDriver->exec(query); return d->processResults(); } @@ -490,7 +490,7 @@ QSqlRecord QPSQLResult::record() const int count = PQnfields(d->result); for (int i = 0; i < count; ++i) { QSqlField f; - if (d->driver->isUtf8) + if (d->privDriver->isUtf8) f.setName(QString::fromUtf8(PQfname(d->result, i))); else f.setName(QString::fromLocal8Bit(PQfname(d->result, i))); @@ -562,11 +562,11 @@ bool QPSQLResult::prepare(const QString &query) const QString stmtId = qMakePreparedStmtId(); const QString stmt = QString::fromLatin1("PREPARE %1 AS ").arg(stmtId).append(QSqlResultPrivate::positionalToNamedBinding(query, QPSQLResultPrivate::fieldSerial)); - PGresult *result = d->driver->exec(stmt); + PGresult *result = d->privDriver->exec(stmt); if (PQresultStatus(result) != PGRES_COMMAND_OK) { setLastError(qMakeError(QCoreApplication::translate("QPSQLResult", - "Unable to prepare statement"), QSqlError::StatementError, d->driver, result)); + "Unable to prepare statement"), QSqlError::StatementError, d->privDriver, result)); PQclear(result); d->preparedStmtId.clear(); return false; @@ -591,7 +591,7 @@ bool QPSQLResult::exec() else stmt = QString::fromLatin1("EXECUTE %1 (%2)").arg(d->preparedStmtId).arg(params); - d->result = d->driver->exec(stmt); + d->result = d->privDriver->exec(stmt); return d->processResults(); } -- cgit v1.2.3 From 4da840f23092f292012d5b1462727cbc8e8fdc31 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Sun, 10 Feb 2013 22:20:24 +0100 Subject: make static function a class member Change-Id: I8c18c746185f6b7530ed985f4d482a1c9073fb10 Reviewed-by: Andy Shaw --- src/sql/drivers/psql/qsql_psql.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/sql/drivers') diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 332f7f7ed2..6a37e4b50d 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -185,6 +185,7 @@ class QPSQLResultPrivate public: QPSQLResultPrivate(QPSQLResult *qq): q(qq), privDriver(0), result(0), currentSize(-1), preparedQueriesEnabled(false) {} static QString fieldSerial(int i) { return QLatin1Char('$') + QString::number(i + 1); } + void deallocatePreparedStmt(); QPSQLResult *q; const QPSQLDriverPrivate *privDriver; @@ -276,15 +277,15 @@ static QVariant::Type qDecodePSQLType(int t) return type; } -static void qDeallocatePreparedStmt(QPSQLResultPrivate *d) +void QPSQLResultPrivate::deallocatePreparedStmt() { - const QString stmt = QLatin1String("DEALLOCATE ") + d->preparedStmtId; - PGresult *result = d->privDriver->exec(stmt); + const QString stmt = QLatin1String("DEALLOCATE ") + preparedStmtId; + PGresult *result = privDriver->exec(stmt); if (PQresultStatus(result) != PGRES_COMMAND_OK) - qWarning("Unable to free statement: %s", PQerrorMessage(d->privDriver->connection)); + qWarning("Unable to free statement: %s", PQerrorMessage(privDriver->connection)); PQclear(result); - d->preparedStmtId.clear(); + preparedStmtId.clear(); } QPSQLResult::QPSQLResult(const QPSQLDriver* db, const QPSQLDriverPrivate* p) @@ -300,7 +301,7 @@ QPSQLResult::~QPSQLResult() cleanup(); if (d->preparedQueriesEnabled && !d->preparedStmtId.isNull()) - qDeallocatePreparedStmt(d); + d->deallocatePreparedStmt(); delete d; } @@ -557,7 +558,7 @@ bool QPSQLResult::prepare(const QString &query) cleanup(); if (!d->preparedStmtId.isEmpty()) - qDeallocatePreparedStmt(d); + d->deallocatePreparedStmt(); const QString stmtId = qMakePreparedStmtId(); const QString stmt = QString::fromLatin1("PREPARE %1 AS ").arg(stmtId).append(QSqlResultPrivate::positionalToNamedBinding(query, QPSQLResultPrivate::fieldSerial)); -- cgit v1.2.3 From bc5170f274572a4b262569c12d5d3c6ef892aaf2 Mon Sep 17 00:00:00 2001 From: Israel Lins Date: Fri, 15 Feb 2013 19:40:35 -0300 Subject: ODBC: improve detection of DBMS Change-Id: Ia93c3adb54fd28e290ff6fc85cb98138514885f1 Reviewed-by: Mark Brand --- src/sql/drivers/odbc/qsql_odbc.cpp | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'src/sql/drivers') diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index a52e3ee451..8f2e4c0cc6 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -115,9 +115,10 @@ class QODBCDriverPrivate { public: enum DefaultCase{Lower, Mixed, Upper, Sensitive}; + enum DBMSType {UnknownDB, MSSqlServer, MySqlServer, PostgreSQL, Oracle, Sybase}; QODBCDriverPrivate() - : hEnv(0), hDbc(0), unicode(false), useSchema(false), disconnectCount(0), datetime_precision(19), isMySqlServer(false), - isMSSqlServer(false), isFreeTDSDriver(false), hasSQLFetchScroll(true), + : hEnv(0), hDbc(0), unicode(false), useSchema(false), disconnectCount(0), datetime_precision(19), + dbmsType(UnknownDB), isFreeTDSDriver(false), hasSQLFetchScroll(true), hasMultiResultSets(false), isQuoteInitialized(false), quote(QLatin1Char('"')) { } @@ -129,15 +130,14 @@ public: bool useSchema; int disconnectCount; int datetime_precision; - bool isMySqlServer; - bool isMSSqlServer; + DBMSType dbmsType; bool isFreeTDSDriver; bool hasSQLFetchScroll; bool hasMultiResultSets; bool checkDriver() const; void checkUnicode(); - void checkSqlServer(); + void checkDBMS(); void checkHasSQLFetchScroll(); void checkHasMultiResults(); void checkSchemaUsage(); @@ -1806,7 +1806,7 @@ bool QODBCDriver::hasFeature(DriverFeature f) const case MultipleResultSets: return d->hasMultiResultSets; case BLOB: { - if(d->isMySqlServer) + if (d->dbmsType == QODBCDriverPrivate::MySqlServer) return true; else return false; @@ -1896,13 +1896,13 @@ bool QODBCDriver::open(const QString & db, d->checkUnicode(); d->checkSchemaUsage(); - d->checkSqlServer(); + d->checkDBMS(); d->checkHasSQLFetchScroll(); d->checkHasMultiResults(); d->checkDateTimePrecision(); setOpen(true); setOpenError(false); - if(d->isMSSqlServer) { + if (d->dbmsType == QODBCDriverPrivate::MSSqlServer) { QSqlQuery i(createResult()); i.exec(QLatin1String("SET QUOTED_IDENTIFIER ON")); } @@ -2069,7 +2069,7 @@ void QODBCDriverPrivate::checkSchemaUsage() useSchema = (val != 0); } -void QODBCDriverPrivate::checkSqlServer() +void QODBCDriverPrivate::checkDBMS() { SQLRETURN r; QVarLengthArray serverString(200); @@ -2088,8 +2088,16 @@ void QODBCDriverPrivate::checkSqlServer() #else serverType = QString::fromUtf8((const char *)serverString.constData(), t); #endif - isMySqlServer = serverType.contains(QLatin1String("mysql"), Qt::CaseInsensitive); - isMSSqlServer = serverType.contains(QLatin1String("Microsoft SQL Server"), Qt::CaseInsensitive); + if (serverType.contains(QLatin1String("PostgreSQL"), Qt::CaseInsensitive)) + dbmsType = PostgreSQL; + else if (serverType.contains(QLatin1String("Oracle"), Qt::CaseInsensitive)) + dbmsType = Oracle; + else if (serverType.contains(QLatin1String("MySql"), Qt::CaseInsensitive)) + dbmsType = MySqlServer; + else if (serverType.contains(QLatin1String("Microsoft SQL Server"), Qt::CaseInsensitive)) + dbmsType = MSSqlServer; + else if (serverType.contains(QLatin1String("Sybase"), Qt::CaseInsensitive)) + dbmsType = Sybase; } r = SQLGetInfo(hDbc, SQL_DRIVER_NAME, -- cgit v1.2.3 From 70bb34ccd5983133118655cd73683750d4f53de7 Mon Sep 17 00:00:00 2001 From: Israel Lins Date: Fri, 15 Feb 2013 19:47:43 -0300 Subject: ODBC: implementation of lastInsertId() Implemented lastInsertId() for some ODBC compatible databases. Change-Id: I0b75a8e68369af39e258e4761b384767ab8a371e Reviewed-by: Mark Brand --- src/sql/drivers/odbc/qsql_odbc.cpp | 38 +++++++++++++++++++++++++++++++++++++- src/sql/drivers/odbc/qsql_odbc_p.h | 1 + 2 files changed, 38 insertions(+), 1 deletion(-) (limited to 'src/sql/drivers') diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 8f2e4c0cc6..a7f583c3b8 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -1677,6 +1677,38 @@ QSqlRecord QODBCResult::record() const return d->rInf; } +QVariant QODBCResult::lastInsertId() const +{ + QString sql; + + switch (d->driverPrivate->dbmsType) { + case QODBCDriverPrivate::MSSqlServer: + case QODBCDriverPrivate::Sybase: + sql = QLatin1String("SELECT @@IDENTITY;"); + break; + case QODBCDriverPrivate::MySqlServer: + sql = QLatin1String("SELECT LAST_INSERT_ID();"); + break; + case QODBCDriverPrivate::PostgreSQL: + sql = QLatin1String("SELECT lastval();"); + break; + default: + break; + } + + if (!sql.isEmpty()) { + QSqlQuery qry(driver()->createResult()); + if (qry.exec(sql) && qry.next()) + return qry.value(0); + + qSqlWarning(QLatin1String("QODBCResult::lastInsertId: Unable to get lastInsertId"), d); + } else { + qSqlWarning(QLatin1String("QODBCResult::lastInsertId: not implemented for this DBMS"), d); + } + + return QVariant(); +} + QVariant QODBCResult::handle() const { return QVariant(qRegisterMetaType("SQLHANDLE"), &d->hStmt); @@ -1797,12 +1829,16 @@ bool QODBCDriver::hasFeature(DriverFeature f) const return true; case QuerySize: case NamedPlaceholders: - case LastInsertId: case BatchOperations: case SimpleLocking: case EventNotifications: case CancelQuery: return false; + case LastInsertId: + return (d->dbmsType == QODBCDriverPrivate::MSSqlServer) + || (d->dbmsType == QODBCDriverPrivate::Sybase) + || (d->dbmsType == QODBCDriverPrivate::MySqlServer) + || (d->dbmsType == QODBCDriverPrivate::PostgreSQL); case MultipleResultSets: return d->hasMultiResultSets; case BLOB: { diff --git a/src/sql/drivers/odbc/qsql_odbc_p.h b/src/sql/drivers/odbc/qsql_odbc_p.h index c1367165f5..191f64f072 100644 --- a/src/sql/drivers/odbc/qsql_odbc_p.h +++ b/src/sql/drivers/odbc/qsql_odbc_p.h @@ -97,6 +97,7 @@ public: bool prepare(const QString& query); bool exec(); + QVariant lastInsertId() const; QVariant handle() const; virtual void setForwardOnly(bool forward); -- cgit v1.2.3 From f4d7b4d10f7d3badbb0ac5ad5c0754a044f8bdd2 Mon Sep 17 00:00:00 2001 From: Israel Lins Date: Tue, 26 Feb 2013 14:23:43 -0300 Subject: PSQL: lastInsertId without OID on table Make lastInsertID work for tables without OIDs. The use of OID in tables is now deprecated in PostgeSQL and lastval() is now provided. http://www.postgresql.org/docs/8.1/interactive/runtime-config-compatible.html#GUC-DEFAULT-WITH-OIDS Change-Id: I01dfdd7a2aab8826487657f691fea3c9268c16b2 Reviewed-by: Israel Lins Albuquerque Reviewed-by: Mark Brand --- src/sql/drivers/psql/qsql_psql.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/sql/drivers') diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp index 6a37e4b50d..7d844fa1bd 100644 --- a/src/sql/drivers/psql/qsql_psql.cpp +++ b/src/sql/drivers/psql/qsql_psql.cpp @@ -474,7 +474,12 @@ int QPSQLResult::numRowsAffected() QVariant QPSQLResult::lastInsertId() const { - if (isActive()) { + if (d->privDriver->pro >= QPSQLDriver::Version81) { + QSqlQuery qry(driver()->createResult()); + // Most recent sequence value obtained from nextval + if (qry.exec(QLatin1String("SELECT lastval();")) && qry.next()) + return qry.value(0); + } else if (isActive()) { Oid id = PQoidValue(d->result); if (id != InvalidOid) return QVariant(id); -- cgit v1.2.3 From d28073d9eb0f35bae534470970e693a94463c549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sat, 2 Mar 2013 15:46:37 +0100 Subject: Distinguish between 'mac' and 'macx' qmake scopes The former applies both on Mac OS X and iOS, but 'macx' is specific to Mac OS X. ios.conf and macx.conf now share most of their settings in the common mac.conf. We set the default QMAKE_MAC_SDK before loading mac.conf, so that any overrides in the device config will apply afterwards. This means configure's mkspec parsing will be able to read the QMAKE_MAC_SDK. Change-Id: I0c7e26a6a0103e19b23ef152aa9e4ab461cee632 Reviewed-by: Oswald Buddenhagen Reviewed-by: Richard Moe Gustavsen --- src/sql/drivers/oci/qsql_oci.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sql/drivers') diff --git a/src/sql/drivers/oci/qsql_oci.pri b/src/sql/drivers/oci/qsql_oci.pri index 9108dbaa3c..66ccdb1abb 100644 --- a/src/sql/drivers/oci/qsql_oci.pri +++ b/src/sql/drivers/oci/qsql_oci.pri @@ -6,4 +6,4 @@ unix { } else { LIBS *= -loci } -macx:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ +mac:QMAKE_LFLAGS += -Wl,-flat_namespace,-U,_environ -- cgit v1.2.3 From b11317a64339f5a4bcffc8234ecaf15c7fb416f2 Mon Sep 17 00:00:00 2001 From: Axel Waggershauser Date: Fri, 15 Mar 2013 00:42:15 +0100 Subject: Whitespace cleanup: remove trailing whitespace Remove all trailing whitespace from the following list of files: *.cpp *.h *.conf *.qdoc *.pro *.pri *.mm *.rc *.pl *.qps *.xpm *.txt *README excluding 3rdparty, test-data and auto generated code. Note A): the only non 3rdparty c++-files that still have trailing whitespace after this change are: * src/corelib/codecs/cp949codetbl_p.h * src/corelib/codecs/qjpunicode.cpp * src/corelib/codecs/qbig5codec.cpp * src/corelib/xml/qxmlstream_p.h * src/tools/qdoc/qmlparser/qqmljsgrammar.cpp * src/tools/uic/ui4.cpp * tests/auto/other/qtokenautomaton/tokenizers/* * tests/benchmarks/corelib/tools/qstring/data.cpp * util/lexgen/tokenizer.cpp Note B): in about 30 files some overlapping 'leading tab' and 'TAB character in non-leading whitespace' issues have been fixed to make the sanity bot happy. Plus some general ws-fixes here and there as asked for during review. Change-Id: Ia713113c34d82442d6ce4d93d8b1cf545075d11d Reviewed-by: Oswald Buddenhagen --- src/sql/drivers/mysql/qsql_mysql.cpp | 10 +++++----- src/sql/drivers/oci/qsql_oci.cpp | 4 ++-- src/sql/drivers/sqlite/qsql_sqlite.cpp | 2 +- src/sql/drivers/sqlite2/qsql_sqlite2.cpp | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/sql/drivers') diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp index 04ba450d46..a529d8c32d 100644 --- a/src/sql/drivers/mysql/qsql_mysql.cpp +++ b/src/sql/drivers/mysql/qsql_mysql.cpp @@ -166,7 +166,7 @@ class QMYSQLResultPrivate : public QObject { Q_OBJECT public: - QMYSQLResultPrivate(const QMYSQLDriver* dp, const QMYSQLResult* d) : driver(dp), result(0), q(d), + QMYSQLResultPrivate(const QMYSQLDriver* dp, const QMYSQLResult* d) : driver(dp), result(0), q(d), rowsAffected(0), hasBlobs(false) #if MYSQL_VERSION_ID >= 40108 , stmt(0), meta(0), inBinds(0), outBinds(0) @@ -788,7 +788,7 @@ bool QMYSQLResult::nextResult() { if(!d->driver) return false; -#if MYSQL_VERSION_ID >= 40100 +#if MYSQL_VERSION_ID >= 40100 setAt(-1); setActive(false); @@ -796,7 +796,7 @@ bool QMYSQLResult::nextResult() mysql_free_result(d->result); d->result = 0; setSelect(false); - + for (int i = 0; i < d->fields.count(); ++i) delete[] d->fields[i].outField; d->fields.clear(); @@ -1374,14 +1374,14 @@ QStringList QMYSQLDriver::tables(QSql::TableType type) const if(type & QSql::Tables) { QString sql = QLatin1String("select table_name from information_schema.tables where table_schema = '") + QLatin1String(d->mysql->db) + QLatin1String("' and table_type = 'BASE TABLE'"); q.exec(sql); - + while(q.next()) tl.append(q.value(0).toString()); } if(type & QSql::Views) { QString sql = QLatin1String("select table_name from information_schema.tables where table_schema = '") + QLatin1String(d->mysql->db) + QLatin1String("' and table_type = 'VIEW'"); q.exec(sql); - + while(q.next()) tl.append(q.value(0).toString()); } diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index 8a6161d816..b0950110e0 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -100,7 +100,7 @@ enum { QOCIEncoding = 2000 }; // AL16UTF16 // Always set the OCI_ATTR_CHARSET_FORM to SQLCS_NCHAR is safe // because Oracle server will deal with the implicit Conversion // Between CHAR and NCHAR. -// see: http://download.oracle.com/docs/cd/A91202_01/901_doc/appdev.901/a89857/oci05bnd.htm#422705 +// see: http://download.oracle.com/docs/cd/A91202_01/901_doc/appdev.901/a89857/oci05bnd.htm#422705 static const ub1 qOraCharsetForm = SQLCS_NCHAR; #endif @@ -2211,7 +2211,7 @@ bool QOCIDriver::open(const QString & db, // Connect without tnsnames.ora if a hostname is given QString connectionString = db; if (!hostname.isEmpty()) - connectionString = + connectionString = QString::fromLatin1("(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=%1)(Port=%2))" "(CONNECT_DATA=(SID=%3)))").arg(hostname).arg((port > -1 ? port : 1521)).arg(db); diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index 483c640b43..1af5d6274e 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -68,7 +68,7 @@ Q_DECLARE_METATYPE(sqlite3_stmt*) QT_BEGIN_NAMESPACE -static QString _q_escapeIdentifier(const QString &identifier) +static QString _q_escapeIdentifier(const QString &identifier) { QString res = identifier; if(!identifier.isEmpty() && identifier.left(1) != QString(QLatin1Char('"')) && identifier.right(1) != QString(QLatin1Char('"')) ) { diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp index a85a120973..1a16b85470 100644 --- a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp +++ b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp @@ -195,7 +195,7 @@ void QSQLite2ResultPrivate::init(const char **cnames, int numCols) for (int i = 0; i < numCols; ++i) { const char* lastDot = strrchr(cnames[i], '.'); const char* fieldName = lastDot ? lastDot + 1 : cnames[i]; - + //remove quotations around the field name if any QString fieldStr = QString::fromLatin1(fieldName); QLatin1Char quote('\"'); @@ -244,7 +244,7 @@ bool QSQLite2ResultPrivate::fetchNext(QSqlCachedResult::ValueCache &values, int firstRow.clear(); firstRow.resize(colNum); } - + switch(res) { case SQLITE_ROW: // check to see if should fill out columns -- cgit v1.2.3 From d1b4857d1718ef50dba64c8700253fed5d187ab2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 10 Mar 2013 13:34:52 -0700 Subject: Make sure that we #include qconfig.h before testing for features. This is mandatory in public headers (qiodevice.h, qopengl*, etc.), but it's a good idea even in private headers, in case someone includes that header first somewhere. In particular, all platformsupport API is private. Change-Id: If287baa5d9ed14e93c1666efa0e6332c4c1cd9a4 Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- src/sql/drivers/db2/qsql_db2_p.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/sql/drivers') diff --git a/src/sql/drivers/db2/qsql_db2_p.h b/src/sql/drivers/db2/qsql_db2_p.h index 6a5363740b..68563448ed 100644 --- a/src/sql/drivers/db2/qsql_db2_p.h +++ b/src/sql/drivers/db2/qsql_db2_p.h @@ -53,6 +53,8 @@ // We mean it. // +#include + #ifdef QT_PLUGIN #define Q_EXPORT_SQLDRIVER_DB2 #else -- cgit v1.2.3