1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-05 08:32:42 +02:00

Merge pull request #277 from tomahawk-player/fix-qsqldatabase-warning

Look into the list of driver instead of probing.
This commit is contained in:
Christian Muehlhaeuser 2014-11-17 05:57:17 +01:00
commit c6157ebba2

View File

@ -739,10 +739,15 @@ Tomahawk::DatabaseImpl::openDatabase( const QString& dbname, bool checkSchema )
{
if ( sqlDriver.isEmpty() )
{
sqlDriver = QString( "QSQLITE3" );
QSqlDatabase testdb = QSqlDatabase::addDatabase( sqlDriver, "testDriverConnection" );
if ( !testdb.isValid() )
sqlDriver = QString( "QSQLITE" );
QStringList drivers = QSqlDatabase::drivers();
if (drivers.contains( "QSQLITE3" ))
{
sqlDriver = "QSQLITE3";
}
else
{
sqlDriver = "QSQLITE";
}
}
QSqlDatabase db = QSqlDatabase::addDatabase( sqlDriver, connName );