1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-21 00:12:06 +02:00

* Fixed style / typo.

This commit is contained in:
Christian Muehlhaeuser 2011-04-16 00:18:20 +02:00
parent 1ecb799694
commit dca94f864d

View File

@ -160,7 +160,7 @@ DatabaseImpl::updateSearchIndex()
bool
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
{
qDebug() << "Create tables... old version is" << oldVersion;
@ -181,11 +181,13 @@ DatabaseImpl::updateSchema( int oldVersion )
db.commit();
return true;
} else // update in place! run the proper upgrade script
}
else // update in place! run the proper upgrade script
{
int cur = oldVersion;
db.transaction();
while( cur < CURRENT_SCHEMA_VERSION ) {
while ( cur < CURRENT_SCHEMA_VERSION )
{
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..";
return false;
}
QString sql = QString::fromUtf8( script.readAll() ).trimmed();
QStringList statements = sql.split( ";", QString::SkipEmptyParts );
foreach( const QString& sql, statements )
{
QString clean = cleanSql( sql ).trimmed();
@ -215,6 +217,7 @@ DatabaseImpl::updateSchema( int oldVersion )
}
}
QString
DatabaseImpl::cleanSql( const QString& sql )
{