summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2020-01-22 13:47:08 +0100
committerLeander Beernaert <leander.beernaert@qt.io>2020-01-24 13:17:33 +0100
commit502d3d6744913899da87acfda5ebdab42c40329e (patch)
tree16658a328503bfd5a62b4fd5d69ffb66e9854b18 /src/plugins/sqldrivers
parentd1be8b9ceb2c7b20bbe53a07154c79699540ea3d (diff)
parent06bb315beb6c2c398223cfe52cbc7f66e14a8557 (diff)
Merge remote-tracking branch 'origin/dev' into merge-dev
Diffstat (limited to 'src/plugins/sqldrivers')
-rw-r--r--src/plugins/sqldrivers/README4
-rw-r--r--src/plugins/sqldrivers/configure.json2
-rw-r--r--src/plugins/sqldrivers/mysql/main.cpp4
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql_p.h4
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp41
-rw-r--r--src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp9
-rw-r--r--src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h4
-rw-r--r--src/plugins/sqldrivers/tds/qsql_tds_p.h4
8 files changed, 24 insertions, 48 deletions
diff --git a/src/plugins/sqldrivers/README b/src/plugins/sqldrivers/README
index 7000fb5613..26418c5e36 100644
--- a/src/plugins/sqldrivers/README
+++ b/src/plugins/sqldrivers/README
@@ -1,5 +1,5 @@
-Please note that the DB2, Oracle and TDS client drivers are not distributed
-with the Qt Open Source Editions.
+Please note that the DB2, MySQL, Oracle and TDS client drivers are not
+distributed with the Qt Open Source Editions.
This is because the client libraries are distributed under a license which
is not compatible with the GPL license.
diff --git a/src/plugins/sqldrivers/configure.json b/src/plugins/sqldrivers/configure.json
index 441cdc4885..94cf2dd4a5 100644
--- a/src/plugins/sqldrivers/configure.json
+++ b/src/plugins/sqldrivers/configure.json
@@ -72,7 +72,9 @@
{ "type": "mysqlConfig", "query": "--libs_r", "cleanlibs": false },
{ "type": "mysqlConfig", "query": "--libs", "cleanlibs": false },
{ "libs": "-lmysqlclient_r", "condition": "!config.win32" },
+ { "libs": "-llibmariadb", "condition": "config.win32" },
{ "libs": "-llibmysql", "condition": "config.win32" },
+ { "libs": "-lmariadb", "condition": "!config.win32" },
{ "libs": "-lmysqlclient", "condition": "!config.win32" }
]
},
diff --git a/src/plugins/sqldrivers/mysql/main.cpp b/src/plugins/sqldrivers/mysql/main.cpp
index d8d70483ef..4c6753097f 100644
--- a/src/plugins/sqldrivers/mysql/main.cpp
+++ b/src/plugins/sqldrivers/mysql/main.cpp
@@ -61,7 +61,9 @@ QMYSQLDriverPlugin::QMYSQLDriverPlugin()
QSqlDriver* QMYSQLDriverPlugin::create(const QString &name)
{
- if (name == QLatin1String("QMYSQL") || name == QLatin1String("QMYSQL3")) {
+ if (name == QLatin1String("QMYSQL") ||
+ name == QLatin1String("QMYSQL3") ||
+ name == QLatin1String("QMARIADB")) {
QMYSQLDriver* driver = new QMYSQLDriver();
return driver;
}
diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql_p.h b/src/plugins/sqldrivers/mysql/qsql_mysql_p.h
index 48b04fb1f5..9ccc8f4e4f 100644
--- a/src/plugins/sqldrivers/mysql/qsql_mysql_p.h
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql_p.h
@@ -75,8 +75,8 @@ class Q_EXPORT_SQLDRIVER_MYSQL QMYSQLDriver : public QSqlDriver
Q_DECLARE_PRIVATE(QMYSQLDriver)
Q_OBJECT
public:
- explicit QMYSQLDriver(QObject *parent=0);
- explicit QMYSQLDriver(MYSQL *con, QObject * parent=0);
+ explicit QMYSQLDriver(QObject *parent=nullptr);
+ explicit QMYSQLDriver(MYSQL *con, QObject * parent=nullptr);
~QMYSQLDriver();
bool hasFeature(DriverFeature f) const override;
bool open(const QString & db,
diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
index 68313b7ff0..27841d9494 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql.cpp
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
@@ -692,40 +692,24 @@ QVariant QPSQLResult::data(int i)
return dbl;
}
case QVariant::Date:
- if (val[0] == '\0') {
- return QVariant(QDate());
- } else {
#if QT_CONFIG(datestring)
- return QVariant(QDate::fromString(QString::fromLatin1(val), Qt::ISODate));
+ return QVariant(QDate::fromString(QString::fromLatin1(val), Qt::ISODate));
#else
- return QVariant(QString::fromLatin1(val));
+ return QVariant(QString::fromLatin1(val));
#endif
- }
- case QVariant::Time: {
- const QString str = QString::fromLatin1(val);
+ case QVariant::Time:
#if QT_CONFIG(datestring)
- if (str.isEmpty())
- return QVariant(QTime());
- else
- return QVariant(QTime::fromString(str, Qt::ISODate));
+ return QVariant(QTime::fromString(QString::fromLatin1(val), Qt::ISODate));
#else
- return QVariant(str);
+ return QVariant(QString::fromLatin1(val));
#endif
- }
- case QVariant::DateTime: {
- QString dtval = QString::fromLatin1(val);
+ case QVariant::DateTime:
#if QT_CONFIG(datestring)
- if (dtval.length() < 10) {
- return QVariant(QDateTime());
- } else {
- QChar sign = dtval[dtval.size() - 3];
- if (sign == QLatin1Char('-') || sign == QLatin1Char('+')) dtval += QLatin1String(":00");
- return QVariant(QDateTime::fromString(dtval, Qt::ISODate).toLocalTime());
- }
+ return QVariant(QDateTime::fromString(QString::fromLatin1(val),
+ Qt::ISODate).toLocalTime());
#else
- return QVariant(dtval);
+ return QVariant(QString::fromLatin1(val));
#endif
- }
case QVariant::ByteArray: {
size_t len;
unsigned char *data = PQunescapeBytea((const unsigned char*)val, &len);
@@ -838,6 +822,7 @@ QSqlRecord QPSQLResult::record() const
}
int ptype = PQftype(d->result, i);
f.setType(qDecodePSQLType(ptype));
+ f.setValue(QVariant(f.type())); // only set in setType() when it's invalid before
int len = PQfsize(d->result, i);
int precision = PQfmod(d->result, i);
@@ -1699,12 +1684,6 @@ void QPSQLDriver::_q_handleNotification(int)
if (notify->extra)
payload = d->isUtf8 ? QString::fromUtf8(notify->extra) : QString::fromLatin1(notify->extra);
#endif
-#if QT_DEPRECATED_SINCE(5, 15)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- emit notification(name);
-QT_WARNING_POP
-#endif
QSqlDriver::NotificationSource source = (notify->be_pid == PQbackendPID(d->connection)) ? QSqlDriver::SelfSource : QSqlDriver::OtherSource;
emit notification(name, source, payload);
}
diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
index 65d3f0a580..5ef76eec21 100644
--- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
+++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
@@ -1043,15 +1043,8 @@ QStringList QSQLiteDriver::subscribedToNotifications() const
void QSQLiteDriver::handleNotification(const QString &tableName, qint64 rowid)
{
Q_D(const QSQLiteDriver);
- if (d->notificationid.contains(tableName)) {
-#if QT_DEPRECATED_SINCE(5, 15)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- emit notification(tableName);
-QT_WARNING_POP
-#endif
+ if (d->notificationid.contains(tableName))
emit notification(tableName, QSqlDriver::UnknownSource, QVariant(rowid));
- }
}
QT_END_NAMESPACE
diff --git a/src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h b/src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h
index 48c64536f1..57db0a4d47 100644
--- a/src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h
+++ b/src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h
@@ -76,8 +76,8 @@ class Q_EXPORT_SQLDRIVER_SQLITE2 QSQLite2Driver : public QSqlDriver
Q_DECLARE_PRIVATE(QSQLite2Driver)
Q_OBJECT
public:
- explicit QSQLite2Driver(QObject *parent = 0);
- explicit QSQLite2Driver(sqlite *connection, QObject *parent = 0);
+ explicit QSQLite2Driver(QObject *parent = nullptr);
+ explicit QSQLite2Driver(sqlite *connection, QObject *parent = nullptr);
~QSQLite2Driver();
bool hasFeature(DriverFeature f) const override;
bool open(const QString &db,
diff --git a/src/plugins/sqldrivers/tds/qsql_tds_p.h b/src/plugins/sqldrivers/tds/qsql_tds_p.h
index 948e3c7024..b72fababbb 100644
--- a/src/plugins/sqldrivers/tds/qsql_tds_p.h
+++ b/src/plugins/sqldrivers/tds/qsql_tds_p.h
@@ -85,8 +85,8 @@ class Q_EXPORT_SQLDRIVER_TDS QTDSDriver : public QSqlDriver
Q_OBJECT
friend class QTDSResultPrivate;
public:
- explicit QTDSDriver(QObject* parent = 0);
- QTDSDriver(LOGINREC* rec, const QString& host, const QString &db, QObject* parent = 0);
+ explicit QTDSDriver(QObject* parent = nullptr);
+ QTDSDriver(LOGINREC* rec, const QString& host, const QString &db, QObject* parent = nullptr);
~QTDSDriver();
bool hasFeature(DriverFeature f) const override;
bool open(const QString &db,