summaryrefslogtreecommitdiffstats
path: root/src/sql/drivers/mysql
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2016-02-22 12:13:14 -0600
committerSlávek Banko <[email protected]>2016-02-27 01:15:44 +0100
commit5ed17bc48364982d3c2b9b99a8cd99fdc661241f (patch)
tree9dbbd87151301f31f9ea79999f908655a59972e9 /src/sql/drivers/mysql
parent9c08980957eb98fc699b4141f0ef2bff2555168c (diff)
downloadqt3-5ed17bc48364982d3c2b9b99a8cd99fdc661241f.tar.gz
qt3-5ed17bc48364982d3c2b9b99a8cd99fdc661241f.zip
Properly implement MySQL reconnect support
(cherry picked from commit 709f7e70b0a12749ab34f47a16946374bcb887bd)
Diffstat (limited to 'src/sql/drivers/mysql')
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index 4b576d9..5296f71 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -495,6 +495,7 @@ bool QMYSQLDriver::open( const QString& db,
return FALSE;
}
+ my_bool reconnect = 0;
for ( it = opts.begin(); it != opts.end(); ++it ) {
QString opt( (*it).upper() );
if ( opt == "CLIENT_COMPRESS" )
@@ -512,11 +513,13 @@ bool QMYSQLDriver::open( const QString& db,
else if ( opt == "CLIENT_SSL" )
clientOptionFlags |= CLIENT_SSL;
else if ( opt == "MYSQL_OPT_RECONNECT" )
- mysql_options(d->mysql, MYSQL_OPT_RECONNECT, NULL);
- else
+ reconnect = 1;
+ else
qWarning( "QMYSQLDriver::open: Unknown connect option '%s'", (*it).latin1() );
}
+ mysql_options(d->mysql, MYSQL_OPT_RECONNECT, &reconnect);
+
if ( mysql_real_connect( d->mysql,
host,
user,