2018-10-22 Fred Gleason <fredg@paravelsystems.com>

* Fixed a ''qt_sql_default_connection' is still in use' runtime
	warning emitted by the 'RDDbValid()' function.
This commit is contained in:
Fred Gleason 2018-10-22 20:35:17 -04:00
parent 5b3cd9e4ab
commit 15c0449489
2 changed files with 14 additions and 7 deletions

View File

@ -17877,3 +17877,6 @@
2018-10-22 Patrick Linstruth <patrick@deltecent.com> 2018-10-22 Patrick Linstruth <patrick@deltecent.com>
* Fixed a bug in 'configure.ac' that broke the 'make rpm' target * Fixed a bug in 'configure.ac' that broke the 'make rpm' target
when used with long version strings. when used with long version strings.
2018-10-22 Fred Gleason <fredg@paravelsystems.com>
* Fixed a ''qt_sql_default_connection' is still in use' runtime
warning emitted by the 'RDDbValid()' function.

View File

@ -68,12 +68,14 @@ bool RDDbValid(RDConfig *config,int *schema)
QSqlQuery *q; QSqlQuery *q;
bool ret=false; bool ret=false;
QSqlDatabase db=QSqlDatabase::addDatabase(config->mysqlDriver()); QSqlDatabase *db=
db.setDatabaseName(config->mysqlDbname()); new QSqlDatabase(QSqlDatabase::addDatabase(config->mysqlDriver()));
db.setUserName(config->mysqlUsername()); QString conn_name=db->connectionName();
db.setPassword(config->mysqlPassword()); db->setDatabaseName(config->mysqlDbname());
db.setHostName(config->mysqlHostname()); db->setUserName(config->mysqlUsername());
if(db.open()) { db->setPassword(config->mysqlPassword());
db->setHostName(config->mysqlHostname());
if(db->open()) {
ret=true; ret=true;
sql="select DB from VERSION"; sql="select DB from VERSION";
q=new QSqlQuery(sql); q=new QSqlQuery(sql);
@ -81,8 +83,10 @@ bool RDDbValid(RDConfig *config,int *schema)
*schema=q->value(0).toInt(); *schema=q->value(0).toInt();
} }
delete q; delete q;
db.close(); db->close();
} }
delete db;
QSqlDatabase::removeDatabase(conn_name);
return ret; return ret;
} }