Properly implement MySQL reconnect support

pull/2/head
Timothy Pearson 8 years ago
parent 9fe256ac6c
commit 709f7e70b0

@ -495,6 +495,7 @@ bool QMYSQLDriver::open( const QString& db,
return FALSE; return FALSE;
} }
my_bool reconnect = 0;
for ( it = opts.begin(); it != opts.end(); ++it ) { for ( it = opts.begin(); it != opts.end(); ++it ) {
QString opt( (*it).upper() ); QString opt( (*it).upper() );
if ( opt == "CLIENT_COMPRESS" ) if ( opt == "CLIENT_COMPRESS" )
@ -512,11 +513,13 @@ bool QMYSQLDriver::open( const QString& db,
else if ( opt == "CLIENT_SSL" ) else if ( opt == "CLIENT_SSL" )
clientOptionFlags |= CLIENT_SSL; clientOptionFlags |= CLIENT_SSL;
else if ( opt == "MYSQL_OPT_RECONNECT" ) else if ( opt == "MYSQL_OPT_RECONNECT" )
mysql_options(d->mysql, MYSQL_OPT_RECONNECT, NULL); reconnect = 1;
else else
qWarning( "QMYSQLDriver::open: Unknown connect option '%s'", (*it).latin1() ); qWarning( "QMYSQLDriver::open: Unknown connect option '%s'", (*it).latin1() );
} }
mysql_options(d->mysql, MYSQL_OPT_RECONNECT, &reconnect);
if ( mysql_real_connect( d->mysql, if ( mysql_real_connect( d->mysql,
host, host,
user, user,

Loading…
Cancel
Save