mirror of
https://github.com/fralx/LimeReport.git
synced 2025-10-09 14:04:43 +03:00
Connection will be restored if server is gone away or drop limereport connection
This commit is contained in:
@@ -735,6 +735,11 @@ void DataSourceManager::setReportSettings(ReportSettings *reportSettings)
|
||||
m_reportSettings = reportSettings;
|
||||
}
|
||||
|
||||
bool DataSourceManager::checkConnection(QSqlDatabase db){
|
||||
QSqlQuery query("Select 1",db);
|
||||
return query.first();
|
||||
}
|
||||
|
||||
bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc)
|
||||
{
|
||||
|
||||
@@ -759,7 +764,10 @@ bool DataSourceManager::connectConnection(ConnectionDesc *connectionDesc)
|
||||
db.close();
|
||||
connected = initAndOpenDB(db, *connectionDesc);
|
||||
} else {
|
||||
connected = db.isOpen();
|
||||
//connected = db.isOpen();
|
||||
connected = checkConnection(db);
|
||||
if (!connected)
|
||||
connected = initAndOpenDB(db, *connectionDesc);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user