* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include "abstractsqlstorage.h"
***************************************************************************/
#include "abstractsqlstorage.h"
- return QSqlDatabase::database(_connectionPool[QThread::currentThread()]->name());
+ QSqlDatabase db = QSqlDatabase::database(_connectionPool[QThread::currentThread()]->name(),false);
+
+ if (!db.isOpen()) {
+ qWarning() << "Database connection" << displayName() << "for thread" << QThread::currentThread() << "was lost, attempting to reconnect...";
+ dbConnect(db);
+ }
+
+ return db;
- qWarning() << "Unable to open database" << displayName() << "for thread" << QThread::currentThread();
- qWarning() << "-" << db.lastError().text();
+ quWarning() << "Unable to open database" << displayName() << "for thread" << QThread::currentThread();
+ quWarning() << "-" << db.lastError().text();
qWarning() << " bound Values:";
QList<QVariant> list = boundValues();
for (int i = 0; i < list.size(); ++i)
qWarning() << " bound Values:";
QList<QVariant> list = boundValues();
for (int i = 0; i < list.size(); ++i)
qWarning() << " Error Number:" << lastError().number();
qWarning() << " Error Message:" << lastError().text();
}
qWarning() << " Error Number:" << lastError().number();
qWarning() << " Error Message:" << lastError().text();
}