mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-10 08:04:25 +02:00
* Fixed style / typo.
This commit is contained in:
@@ -160,7 +160,7 @@ DatabaseImpl::updateSearchIndex()
|
|||||||
bool
|
bool
|
||||||
DatabaseImpl::updateSchema( int oldVersion )
|
DatabaseImpl::updateSchema( int oldVersion )
|
||||||
{
|
{
|
||||||
// we are called here with the old database. we must migrate it to the CURRENT_SCHEMA_VERSION from t7he oldVersion
|
// we are called here with the old database. we must migrate it to the CURRENT_SCHEMA_VERSION from the oldVersion
|
||||||
if ( oldVersion == 0 ) // empty database, so create our tables and stuff
|
if ( oldVersion == 0 ) // empty database, so create our tables and stuff
|
||||||
{
|
{
|
||||||
qDebug() << "Create tables... old version is" << oldVersion;
|
qDebug() << "Create tables... old version is" << oldVersion;
|
||||||
@@ -181,11 +181,13 @@ DatabaseImpl::updateSchema( int oldVersion )
|
|||||||
|
|
||||||
db.commit();
|
db.commit();
|
||||||
return true;
|
return true;
|
||||||
} else // update in place! run the proper upgrade script
|
}
|
||||||
|
else // update in place! run the proper upgrade script
|
||||||
{
|
{
|
||||||
int cur = oldVersion;
|
int cur = oldVersion;
|
||||||
db.transaction();
|
db.transaction();
|
||||||
while( cur < CURRENT_SCHEMA_VERSION ) {
|
while ( cur < CURRENT_SCHEMA_VERSION )
|
||||||
|
{
|
||||||
cur++;
|
cur++;
|
||||||
|
|
||||||
QString path = QString( RESPATH "sql/dbmigrate-%1_to_%2.sql" ).arg( cur - 1 ).arg( cur );
|
QString path = QString( RESPATH "sql/dbmigrate-%1_to_%2.sql" ).arg( cur - 1 ).arg( cur );
|
||||||
@@ -195,9 +197,9 @@ DatabaseImpl::updateSchema( int oldVersion )
|
|||||||
qWarning() << "Failed to find or open upgrade script from" << (cur-1) << "to" << cur << " (" << path << ")! Aborting upgrade..";
|
qWarning() << "Failed to find or open upgrade script from" << (cur-1) << "to" << cur << " (" << path << ")! Aborting upgrade..";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString sql = QString::fromUtf8( script.readAll() ).trimmed();
|
QString sql = QString::fromUtf8( script.readAll() ).trimmed();
|
||||||
QStringList statements = sql.split( ";", QString::SkipEmptyParts );
|
QStringList statements = sql.split( ";", QString::SkipEmptyParts );
|
||||||
|
|
||||||
foreach( const QString& sql, statements )
|
foreach( const QString& sql, statements )
|
||||||
{
|
{
|
||||||
QString clean = cleanSql( sql ).trimmed();
|
QString clean = cleanSql( sql ).trimmed();
|
||||||
@@ -215,6 +217,7 @@ DatabaseImpl::updateSchema( int oldVersion )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
DatabaseImpl::cleanSql( const QString& sql )
|
DatabaseImpl::cleanSql( const QString& sql )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user