summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2013-03-30 19:55:25 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-02 19:02:26 +0200
commit406c8ef6e67da5505c7404a2517a8b4204d7c38a (patch)
tree1257c680456e3fa4e386995f7703096982863ac0
parentdcf9c403ba8e903bb52a6fb656c7e2de23383c10 (diff)
Move the dbmstype to QSqlDriverPrivate so it can be used for all drivers
By moving it to QSqlDriverPrivate we make it easier to check what database is actually connected which is particularly useful for the autotests. Change-Id: I54d1c2c998919c1d54efb1b6ac9303070ece54aa Reviewed-by: Mark Brand <mabrand@mabrand.nl>
-rw-r--r--src/plugins/sqldrivers/qsqldriverbase.pri2
-rw-r--r--src/sql/drivers/db2/qsql_db2.cpp6
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.cpp6
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp8
-rw-r--r--src/sql/drivers/oci/qsql_oci.cpp11
-rw-r--r--src/sql/drivers/oci/qsql_oci_p.h2
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp11
-rw-r--r--src/sql/drivers/psql/qsql_psql.cpp10
-rw-r--r--src/sql/drivers/sqlite/qsql_sqlite.cpp6
-rw-r--r--src/sql/drivers/sqlite2/qsql_sqlite2.cpp7
-rw-r--r--src/sql/drivers/tds/qsql_tds.cpp6
-rw-r--r--src/sql/kernel/kernel.pri1
-rw-r--r--src/sql/kernel/qsqldriver.cpp25
-rw-r--r--src/sql/kernel/qsqldriver_p.h91
-rw-r--r--tests/auto/sql/kernel/qsql/qsql.pro2
-rw-r--r--tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro2
-rw-r--r--tests/auto/sql/kernel/qsqldatabase/tst_databases.h18
-rw-r--r--tests/auto/sql/kernel/qsqldriver/qsqldriver.pro2
-rw-r--r--tests/auto/sql/kernel/qsqlquery/qsqlquery.pro2
-rw-r--r--tests/auto/sql/kernel/qsqlthread/qsqlthread.pro2
-rw-r--r--tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro2
-rw-r--r--tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro2
-rw-r--r--tests/benchmarks/sql/kernel/qsqlquery/qsqlquery.pro2
23 files changed, 147 insertions, 79 deletions
diff --git a/src/plugins/sqldrivers/qsqldriverbase.pri b/src/plugins/sqldrivers/qsqldriverbase.pri
index 17424f6764..512c046ec1 100644
--- a/src/plugins/sqldrivers/qsqldriverbase.pri
+++ b/src/plugins/sqldrivers/qsqldriverbase.pri
@@ -1,4 +1,4 @@
-QT = core sql-private
+QT = core core-private sql-private
PLUGIN_TYPE = sqldrivers
load(qt_plugin)
diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp
index 50a9af23bc..25da004db8 100644
--- a/src/sql/drivers/db2/qsql_db2.cpp
+++ b/src/sql/drivers/db2/qsql_db2.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qsql_db2_p.h"
+#include <QtSql/private/qsqldriver_p.h>
#include <qcoreapplication.h>
#include <qdatetime.h>
#include <qsqlfield.h>
@@ -70,10 +71,10 @@ QT_BEGIN_NAMESPACE
static const int COLNAMESIZE = 255;
static const SQLSMALLINT qParamType[4] = { SQL_PARAM_INPUT, SQL_PARAM_INPUT, SQL_PARAM_OUTPUT, SQL_PARAM_INPUT_OUTPUT };
-class QDB2DriverPrivate
+class QDB2DriverPrivate : public QSqlDriverPrivate
{
public:
- QDB2DriverPrivate(): hEnv(0), hDbc(0) {}
+ QDB2DriverPrivate() : QSqlDriverPrivate(), hEnv(0), hDbc(0) { dbmsType = DB2; }
SQLHANDLE hEnv;
SQLHANDLE hDbc;
QString user;
@@ -1151,7 +1152,6 @@ QDB2Driver::QDB2Driver(Qt::HANDLE env, Qt::HANDLE con, QObject* parent)
QDB2Driver::~QDB2Driver()
{
close();
- delete d;
}
bool QDB2Driver::open(const QString& db, const QString& user, const QString& password, const QString& host, int port,
diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp
index abf6a74c3e..2137514679 100644
--- a/src/sql/drivers/ibase/qsql_ibase.cpp
+++ b/src/sql/drivers/ibase/qsql_ibase.cpp
@@ -48,6 +48,7 @@
#include <qsqlindex.h>
#include <qsqlquery.h>
#include <QtSql/private/qsqlcachedresult_p.h>
+#include <QtSql/private/qsqldriver_p.h>
#include <qlist.h>
#include <qvector.h>
#include <qtextcodec.h>
@@ -309,10 +310,10 @@ struct QIBaseEventBuffer {
QIBaseSubscriptionState subscriptionState;
};
-class QIBaseDriverPrivate
+class QIBaseDriverPrivate : public QSqlDriverPrivate
{
public:
- QIBaseDriverPrivate(QIBaseDriver *d) : q(d), ibase(0), trans(0), tc(0) {}
+ QIBaseDriverPrivate(QIBaseDriver *d) : QSqlDriverPrivate(), q(d), ibase(0), trans(0), tc(0) { dbmsType = Interbase; }
bool isError(const char *msg, QSqlError::ErrorType typ = QSqlError::UnknownError)
{
@@ -1411,7 +1412,6 @@ QIBaseDriver::QIBaseDriver(isc_db_handle connection, QObject *parent)
QIBaseDriver::~QIBaseDriver()
{
- delete d;
}
bool QIBaseDriver::hasFeature(DriverFeature f) const
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index a529d8c32d..871b13182f 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -41,6 +41,7 @@
#include "qsql_mysql_p.h"
+#include <QtSql/private/qsqldriver_p.h>
#include <qcoreapplication.h>
#include <qvariant.h>
#include <qdatetime.h>
@@ -76,16 +77,16 @@ Q_DECLARE_METATYPE(MYSQL_STMT*)
QT_BEGIN_NAMESPACE
-class QMYSQLDriverPrivate
+class QMYSQLDriverPrivate : public QSqlDriverPrivate
{
public:
- QMYSQLDriverPrivate() : mysql(0),
+ QMYSQLDriverPrivate() : QSqlDriverPrivate(), mysql(0),
#ifndef QT_NO_TEXTCODEC
tc(QTextCodec::codecForLocale()),
#else
tc(0),
#endif
- preparedQuerysEnabled(false) {}
+ preparedQuerysEnabled(false) { dbmsType = MySqlServer; }
MYSQL *mysql;
QTextCodec *tc;
@@ -1155,7 +1156,6 @@ QMYSQLDriver::~QMYSQLDriver()
qMySqlConnectionCount--;
if (qMySqlConnectionCount == 0 && !qMySqlInitHandledByUser)
qLibraryEnd();
- delete d;
}
bool QMYSQLDriver::hasFeature(DriverFeature f) const
diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp
index b0950110e0..6eb6703ebf 100644
--- a/src/sql/drivers/oci/qsql_oci.cpp
+++ b/src/sql/drivers/oci/qsql_oci.cpp
@@ -52,6 +52,7 @@
#include <qsqlindex.h>
#include <qsqlquery.h>
#include <QtSql/private/qsqlcachedresult_p.h>
+#include <QtSql/private/qsqldriver_p.h>
#include <qstringlist.h>
#include <qvarlengtharray.h>
#include <qvector.h>
@@ -492,8 +493,9 @@ void QOCIResultPrivate::outValues(QVector<QVariant> &values, IndicatorArray &ind
}
-struct QOCIDriverPrivate
+class QOCIDriverPrivate : public QSqlDriverPrivate
{
+public:
QOCIDriverPrivate();
OCIEnv *env;
@@ -511,9 +513,10 @@ struct QOCIDriverPrivate
};
QOCIDriverPrivate::QOCIDriverPrivate()
- : env(0), svc(0), srvhp(0), authp(0), err(0), transaction(false), serverVersion(-1),
- prefetchRows(-1), prefetchMem(QOCI_PREFETCH_MEM)
+ : QSqlDriverPrivate(), env(0), svc(0), srvhp(0), authp(0), err(0), transaction(false),
+ serverVersion(-1), prefetchRows(-1), prefetchMem(QOCI_PREFETCH_MEM)
{
+ dbmsType = Oracle;
}
void QOCIDriverPrivate::allocErrorHandle()
@@ -2137,8 +2140,6 @@ QOCIDriver::~QOCIDriver()
r = OCIHandleFree(d->env, OCI_HTYPE_ENV);
if (r != OCI_SUCCESS)
qWarning("Unable to free Environment handle: %d", r);
-
- delete d;
}
bool QOCIDriver::hasFeature(DriverFeature f) const
diff --git a/src/sql/drivers/oci/qsql_oci_p.h b/src/sql/drivers/oci/qsql_oci_p.h
index fecc828434..0b874e6be3 100644
--- a/src/sql/drivers/oci/qsql_oci_p.h
+++ b/src/sql/drivers/oci/qsql_oci_p.h
@@ -69,7 +69,7 @@ QT_BEGIN_NAMESPACE
class QOCIDriver;
class QOCICols;
-struct QOCIDriverPrivate;
+class QOCIDriverPrivate;
class Q_EXPORT_SQLDRIVER_OCI QOCIDriver : public QSqlDriver
{
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 55c97644b8..f92cda8c25 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -57,6 +57,7 @@
#include <qmath.h>
#include <QDebug>
#include <QSqlQuery>
+#include <QtSql/private/qsqldriver_p.h>
QT_BEGIN_NAMESPACE
@@ -111,15 +112,13 @@ inline static QVarLengthArray<SQLTCHAR> toSQLTCHAR(const QString &input)
return result;
}
-class QODBCDriverPrivate
+class QODBCDriverPrivate : public QSqlDriverPrivate
{
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),
- dbmsType(UnknownDB), isFreeTDSDriver(false), hasSQLFetchScroll(true),
- hasMultiResultSets(false), isQuoteInitialized(false), quote(QLatin1Char('"'))
+ : QSqlDriverPrivate(), hEnv(0), hDbc(0), unicode(false), useSchema(false), disconnectCount(0), datetime_precision(19),
+ isFreeTDSDriver(false), hasSQLFetchScroll(true), hasMultiResultSets(false), isQuoteInitialized(false), quote(QLatin1Char('"'))
{
}
@@ -130,7 +129,6 @@ public:
bool useSchema;
int disconnectCount;
int datetime_precision;
- DBMSType dbmsType;
bool isFreeTDSDriver;
bool hasSQLFetchScroll;
bool hasMultiResultSets;
@@ -1794,7 +1792,6 @@ void QODBCDriver::init()
QODBCDriver::~QODBCDriver()
{
cleanup();
- delete d;
}
bool QODBCDriver::hasFeature(DriverFeature f) const
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp
index 13c985d1df..aed0a11218 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/sql/drivers/psql/qsql_psql.cpp
@@ -54,6 +54,7 @@
#include <qstringlist.h>
#include <qmutex.h>
#include <QtSql/private/qsqlresult_p.h>
+#include <QtSql/private/qsqldriver_p.h>
#include <libpq-fe.h>
#include <pg_config.h>
@@ -121,18 +122,18 @@ inline void qPQfreemem(void *buffer)
PQfreemem(buffer);
}
-class QPSQLDriverPrivate
+class QPSQLDriverPrivate : public QSqlDriverPrivate
{
public:
- QPSQLDriverPrivate(QPSQLDriver *qq)
- : q(qq),
+ QPSQLDriverPrivate(QPSQLDriver *qq) : QSqlDriverPrivate(),
+ q(qq),
connection(0),
isUtf8(false),
pro(QPSQLDriver::Version6),
sn(0),
pendingNotifyCheck(false),
hasBackslashEscape(false)
- { }
+ { dbmsType = PostgreSQL; }
QPSQLDriver *q;
PGconn *connection;
@@ -793,7 +794,6 @@ QPSQLDriver::~QPSQLDriver()
{
if (d->connection)
PQfinish(d->connection);
- delete d;
}
QVariant QPSQLDriver::handle() const
diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp
index 854705b3f6..c78f0b6882 100644
--- a/src/sql/drivers/sqlite/qsql_sqlite.cpp
+++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp
@@ -48,6 +48,7 @@
#include <qsqlindex.h>
#include <qsqlquery.h>
#include <QtSql/private/qsqlcachedresult_p.h>
+#include <QtSql/private/qsqldriver_p.h>
#include <qstringlist.h>
#include <qvector.h>
#include <qdebug.h>
@@ -134,10 +135,10 @@ private:
QSQLiteResultPrivate* d;
};
-class QSQLiteDriverPrivate
+class QSQLiteDriverPrivate : public QSqlDriverPrivate
{
public:
- inline QSQLiteDriverPrivate() : access(0) {}
+ inline QSQLiteDriverPrivate() : QSqlDriverPrivate(), access(0) { dbmsType = SQLite; }
sqlite3 *access;
QList <QSQLiteResult *> results;
};
@@ -546,7 +547,6 @@ QSQLiteDriver::QSQLiteDriver(sqlite3 *connection, QObject *parent)
QSQLiteDriver::~QSQLiteDriver()
{
- delete d;
}
bool QSQLiteDriver::hasFeature(DriverFeature f) const
diff --git a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
index 1a16b85470..39ad122822 100644
--- a/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
+++ b/src/sql/drivers/sqlite2/qsql_sqlite2.cpp
@@ -51,6 +51,7 @@
#include <qsqlindex.h>
#include <qsqlquery.h>
#include <QtSql/private/qsqlcachedresult_p.h>
+#include <QtSql/private/qsqldriver_p.h>
#include <qstringlist.h>
#include <qvector.h>
@@ -82,7 +83,7 @@ static QVariant::Type nameToType(const QString& typeName)
return QVariant::String;
}
-class QSQLite2DriverPrivate
+class QSQLite2DriverPrivate : public QSqlDriverPrivate
{
public:
QSQLite2DriverPrivate();
@@ -90,9 +91,10 @@ public:
bool utf8;
};
-QSQLite2DriverPrivate::QSQLite2DriverPrivate() : access(0)
+QSQLite2DriverPrivate::QSQLite2DriverPrivate() : QSqlDriverPrivate(), access(0)
{
utf8 = (qstrcmp(sqlite_encoding, "UTF-8") == 0);
+ dbmsType = SQLite;
}
class QSQLite2ResultPrivate;
@@ -392,7 +394,6 @@ QSQLite2Driver::QSQLite2Driver(sqlite *connection, QObject *parent)
QSQLite2Driver::~QSQLite2Driver()
{
- delete d;
}
bool QSQLite2Driver::hasFeature(DriverFeature f) const
diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/sql/drivers/tds/qsql_tds.cpp
index 996a1bdd1a..fe59fa8822 100644
--- a/src/sql/drivers/tds/qsql_tds.cpp
+++ b/src/sql/drivers/tds/qsql_tds.cpp
@@ -59,6 +59,7 @@
#include <qsqlindex.h>
#include <qsqlquery.h>
#include <QtSql/private/qsqlcachedresult_p.h>
+#include <QtSql/private/qsqldriver_p.h>
#include <qstringlist.h>
#include <qvector.h>
@@ -136,10 +137,10 @@ QSqlError qMakeError(const QString& err, QSqlError::ErrorType type, int errNo =
return QSqlError(QLatin1String("QTDS: ") + err, QString(), type, errNo);
}
-class QTDSDriverPrivate
+class QTDSDriverPrivate : public QSqlDriverPrivate
{
public:
- QTDSDriverPrivate(): login(0), initialized(false) {}
+ QTDSDriverPrivate() : QSqlDriverPrivate(), login(0), initialized(false) { dbmsType = Sybase; }
LOGINREC* login; // login information
QString hostName;
QString db;
@@ -579,7 +580,6 @@ QTDSDriver::~QTDSDriver()
dbmsghandle(0);
// dbexit also calls dbclose if necessary
dbexit();
- delete d;
}
bool QTDSDriver::hasFeature(DriverFeature f) const
diff --git a/src/sql/kernel/kernel.pri b/src/sql/kernel/kernel.pri
index fe7f1270f9..dad3b46781 100644
--- a/src/sql/kernel/kernel.pri
+++ b/src/sql/kernel/kernel.pri
@@ -4,6 +4,7 @@ HEADERS += kernel/qsql.h \
kernel/qsqlfield.h \
kernel/qsqlrecord.h \
kernel/qsqldriver.h \
+ kernel/qsqldriver_p.h \
kernel/qsqlnulldriver_p.h \
kernel/qsqldriverplugin.h \
kernel/qsqlerror.h \
diff --git a/src/sql/kernel/qsqldriver.cpp b/src/sql/kernel/qsqldriver.cpp
index 690525f8ca..97f95e6280 100644
--- a/src/sql/kernel/qsqldriver.cpp
+++ b/src/sql/kernel/qsqldriver.cpp
@@ -46,6 +46,7 @@
#include "qsqlfield.h"
#include "qsqlindex.h"
#include "private/qobject_p.h"
+#include "private/qsqldriver_p.h"
QT_BEGIN_NAMESPACE
@@ -60,30 +61,6 @@ static QString prepareIdentifier(const QString &identifier,
return ret;
}
-class QSqlDriverPrivate : public QObjectPrivate
-{
-public:
- QSqlDriverPrivate();
- virtual ~QSqlDriverPrivate();
-
-public:
- // @CHECK: this member is never used. It was named q, which expanded to q_func().
- QSqlDriver *q_func();
- uint isOpen : 1;
- uint isOpenError : 1;
- QSqlError error;
- QSql::NumericalPrecisionPolicy precisionPolicy;
-};
-
-inline QSqlDriverPrivate::QSqlDriverPrivate()
- : QObjectPrivate(), isOpen(false), isOpenError(false), precisionPolicy(QSql::LowPrecisionDouble)
-{
-}
-
-QSqlDriverPrivate::~QSqlDriverPrivate()
-{
-}
-
/*!
\class QSqlDriver
\brief The QSqlDriver class is an abstract base class for accessing
diff --git a/src/sql/kernel/qsqldriver_p.h b/src/sql/kernel/qsqldriver_p.h
new file mode 100644
index 0000000000..1e7e3cc7a0
--- /dev/null
+++ b/src/sql/kernel/qsqldriver_p.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** 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 QSQLDRIVER_P_H
+#define QSQLDRIVER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the QtSQL module. This header file may change from version to version
+// without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "private/qobject_p.h"
+#include "qsqldriver.h"
+#include "qsqlerror.h"
+
+QT_BEGIN_NAMESPACE
+
+class QSqlDriverPrivate : public QObjectPrivate
+{
+public:
+ enum DBMSType {UnknownDB, MSSqlServer, MySqlServer, PostgreSQL, Oracle, Sybase, SQLite, Interbase, DB2};
+ QSqlDriverPrivate();
+ virtual ~QSqlDriverPrivate();
+
+public:
+ // @CHECK: this member is never used. It was named q, which expanded to q_func().
+ QSqlDriver *q_func();
+ uint isOpen : 1;
+ uint isOpenError : 1;
+ QSqlError error;
+ QSql::NumericalPrecisionPolicy precisionPolicy;
+ DBMSType dbmsType;
+};
+
+inline QSqlDriverPrivate::QSqlDriverPrivate()
+ : QObjectPrivate(), isOpen(false), isOpenError(false), precisionPolicy(QSql::LowPrecisionDouble),
+ dbmsType(UnknownDB)
+{
+}
+
+QSqlDriverPrivate::~QSqlDriverPrivate()
+{
+}
+
+QT_END_NAMESPACE
+
+#endif // QSQLDRIVER_P_H
diff --git a/tests/auto/sql/kernel/qsql/qsql.pro b/tests/auto/sql/kernel/qsql/qsql.pro
index c890352d45..0735986438 100644
--- a/tests/auto/sql/kernel/qsql/qsql.pro
+++ b/tests/auto/sql/kernel/qsql/qsql.pro
@@ -3,7 +3,7 @@ CONFIG += parallel_test
TARGET = tst_qsql
SOURCES += tst_qsql.cpp
-QT += sql sql-private gui testlib
+QT += sql sql-private gui testlib core-private
wince*: {
DEPLOYMENT_PLUGIN += qsqlite
diff --git a/tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro b/tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro
index 89dc7a5c7c..d562e47c55 100644
--- a/tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro
+++ b/tests/auto/sql/kernel/qsqldatabase/qsqldatabase.pro
@@ -2,7 +2,7 @@ CONFIG += testcase
TARGET = tst_qsqldatabase
SOURCES += tst_qsqldatabase.cpp
-QT = core sql testlib
+QT = core sql testlib core-private sql-private
win32: {
!wince*: LIBS += -lws2_32
diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
index 9d3523576f..0eb3ba8c22 100644
--- a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
+++ b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h
@@ -52,7 +52,7 @@
#include <QVariant>
#include <QDebug>
#include <QSqlTableModel>
-
+#include <QtSql/private/qsqldriver_p.h>
#include <QtTest/QtTest>
#if defined (Q_OS_WIN) || defined (Q_OS_WIN32)
@@ -510,11 +510,8 @@ public:
static bool isSqlServer( QSqlDatabase db )
{
- return db.databaseName().contains( "sql server", Qt::CaseInsensitive )
- || db.databaseName().contains( "sqlserver", Qt::CaseInsensitive )
- || db.databaseName().contains( "sql native client", Qt::CaseInsensitive )
- || db.databaseName().contains( "bq-winserv", Qt::CaseInsensitive )
- || db.hostName().contains( "bq-winserv", Qt::CaseInsensitive );
+ QSqlDriverPrivate *d = static_cast<QSqlDriverPrivate *>(QObjectPrivate::get(db.driver()));
+ return d->dbmsType == QSqlDriverPrivate::MSSqlServer;
}
static bool isMSAccess( QSqlDatabase db )
@@ -524,16 +521,19 @@ public:
static bool isPostgreSQL( QSqlDatabase db )
{
- return db.driverName().startsWith("QPSQL") || (db.driverName().startsWith("QODBC") && ( db.databaseName().contains("PostgreSQL", Qt::CaseInsensitive) || db.databaseName().contains("pgsql", Qt::CaseInsensitive) ) );
+ QSqlDriverPrivate *d = static_cast<QSqlDriverPrivate *>(QObjectPrivate::get(db.driver()));
+ return d->dbmsType == QSqlDriverPrivate::PostgreSQL;
}
static bool isMySQL( QSqlDatabase db )
{
- return db.driverName().startsWith("QMYSQL") || (db.driverName().startsWith("QODBC") && db.databaseName().contains("MySQL", Qt::CaseInsensitive) );
+ QSqlDriverPrivate *d = static_cast<QSqlDriverPrivate *>(QObjectPrivate::get(db.driver()));
+ return d->dbmsType == QSqlDriverPrivate::MySqlServer;
}
static bool isDB2( QSqlDatabase db )
{
- return db.driverName().startsWith("QDB2") || (db.driverName().startsWith("QODBC") && db.databaseName().contains("db2", Qt::CaseInsensitive) );
+ QSqlDriverPrivate *d = static_cast<QSqlDriverPrivate *>(QObjectPrivate::get(db.driver()));
+ return d->dbmsType == QSqlDriverPrivate::DB2;
}
// -1 on fail, else Oracle version
diff --git a/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro b/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro
index ef7bb70a94..abdc157c7f 100644
--- a/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro
+++ b/tests/auto/sql/kernel/qsqldriver/qsqldriver.pro
@@ -3,7 +3,7 @@ CONFIG += parallel_test
TARGET = tst_qsqldriver
SOURCES += tst_qsqldriver.cpp
-QT = core sql testlib
+QT = core sql testlib core-private sql-private
wince*: {
plugFiles.files = ../../../plugins/sqldrivers
diff --git a/tests/auto/sql/kernel/qsqlquery/qsqlquery.pro b/tests/auto/sql/kernel/qsqlquery/qsqlquery.pro
index c1e2a7ebb1..360d874f1a 100644
--- a/tests/auto/sql/kernel/qsqlquery/qsqlquery.pro
+++ b/tests/auto/sql/kernel/qsqlquery/qsqlquery.pro
@@ -3,7 +3,7 @@ CONFIG += testcase
SOURCES += tst_qsqlquery.cpp
-QT = core sql testlib
+QT = core sql testlib core-private sql-private
!wince*:win32:LIBS += -lws2_32
diff --git a/tests/auto/sql/kernel/qsqlthread/qsqlthread.pro b/tests/auto/sql/kernel/qsqlthread/qsqlthread.pro
index 73247545ce..3249309bf4 100644
--- a/tests/auto/sql/kernel/qsqlthread/qsqlthread.pro
+++ b/tests/auto/sql/kernel/qsqlthread/qsqlthread.pro
@@ -2,7 +2,7 @@ CONFIG += testcase
TARGET = tst_qsqlthread
SOURCES += tst_qsqlthread.cpp
-QT = core sql testlib
+QT = core sql testlib core-private sql-private
wince*: {
diff --git a/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro b/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro
index cbbd1d6eb7..40ec56d473 100644
--- a/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro
+++ b/tests/auto/sql/models/qsqlquerymodel/qsqlquerymodel.pro
@@ -2,7 +2,7 @@ CONFIG += testcase
TARGET = tst_qsqlquerymodel
SOURCES += tst_qsqlquerymodel.cpp
-QT += widgets sql testlib
+QT += widgets sql testlib core-private sql-private
wince*: {
DEPLOYMENT_PLUGIN += qsqlite
diff --git a/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro b/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
index 117ad5cbf6..0d7318a5c9 100644
--- a/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
+++ b/tests/auto/sql/models/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
@@ -2,7 +2,7 @@ CONFIG += testcase
TARGET = tst_qsqlrelationaltablemodel
SOURCES += tst_qsqlrelationaltablemodel.cpp
-QT = core sql testlib
+QT = core sql testlib core-private sql-private
wince*: {
plugFiles.files = ../../../plugins/sqldrivers
diff --git a/tests/benchmarks/sql/kernel/qsqlquery/qsqlquery.pro b/tests/benchmarks/sql/kernel/qsqlquery/qsqlquery.pro
index 5c17220190..bfea404980 100644
--- a/tests/benchmarks/sql/kernel/qsqlquery/qsqlquery.pro
+++ b/tests/benchmarks/sql/kernel/qsqlquery/qsqlquery.pro
@@ -2,6 +2,6 @@ TARGET = tst_bench_qsqlquery
SOURCES += main.cpp
-QT = core sql testlib
+QT = core sql testlib core-private sql-private
win32: LIBS += -lws2_32
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0