diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-10-13 23:03:51 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-10-13 23:03:51 +0200 |
commit | b7ac036b727784624cf33f5f11b8d2d1b6f16538 (patch) | |
tree | 3214d3689d3de3f5a770d96529d58d4e03424d1f /src/sql | |
parent | 967e4f258cd39991fd2d0ac3753544900d51fbc2 (diff) | |
parent | a7297ed85bc58a1f242b49a643e3abbdc7cf7e24 (diff) |
Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
src/network/socket/qabstractsocket.cpp
src/plugins/platforms/winrt/qwinrtscreen.cpp
src/sql/drivers/mysql/qsql_mysql.cpp
Change-Id: Ifb73623d09f53340ee5e10283f1f86b580998902
Diffstat (limited to 'src/sql')
-rw-r--r-- | src/sql/drivers/mysql/qsql_mysql.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp index ea8a918dcf..96bdcc42fa 100644 --- a/src/sql/drivers/mysql/qsql_mysql.cpp +++ b/src/sql/drivers/mysql/qsql_mysql.cpp @@ -1325,20 +1325,21 @@ bool QMYSQLDriver::open(const QString& db, if (writeTimeout != 0) mysql_options(d->mysql, MYSQL_OPT_WRITE_TIMEOUT, &writeTimeout); #endif - if (mysql_real_connect(d->mysql, - host.isNull() ? static_cast<const char *>(0) - : host.toLocal8Bit().constData(), - user.isNull() ? static_cast<const char *>(0) - : user.toLocal8Bit().constData(), - password.isNull() ? static_cast<const char *>(0) - : password.toLocal8Bit().constData(), - db.isNull() ? static_cast<const char *>(0) - : db.toLocal8Bit().constData(), - (port > -1) ? port : 0, - unixSocket.isNull() ? static_cast<const char *>(0) - : unixSocket.toLocal8Bit().constData(), - optionFlags)) - { + MYSQL *mysql = mysql_real_connect(d->mysql, + host.isNull() ? static_cast<const char *>(0) + : host.toLocal8Bit().constData(), + user.isNull() ? static_cast<const char *>(0) + : user.toLocal8Bit().constData(), + password.isNull() ? static_cast<const char *>(0) + : password.toLocal8Bit().constData(), + db.isNull() ? static_cast<const char *>(0) + : db.toLocal8Bit().constData(), + (port > -1) ? port : 0, + unixSocket.isNull() ? static_cast<const char *>(0) + : unixSocket.toLocal8Bit().constData(), + optionFlags); + + if (mysql == d->mysql) { if (!db.isEmpty() && mysql_select_db(d->mysql, db.toLocal8Bit().constData())) { setLastError(qMakeError(tr("Unable to open database '%1'").arg(db), QSqlError::ConnectionError, d)); mysql_close(d->mysql); |