mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 19:30:21 +02:00
Make faster
This commit is contained in:
@@ -89,7 +89,6 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
||||
|
||||
m_files << dirquery.value( 1 ).toString();
|
||||
m_ids << dirquery.value( 0 ).toUInt();
|
||||
m_localUrlMapping[ dirquery.value( 0 ).toString() ] = dirquery.value( 1 ).toString();;
|
||||
}
|
||||
}
|
||||
else if ( !m_ids.isEmpty() )
|
||||
@@ -106,10 +105,7 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
||||
dirquery.bindValue( 0, idstring );
|
||||
dirquery.exec();
|
||||
while ( dirquery.next() )
|
||||
{
|
||||
m_files << dirquery.value( 1 ).toString();
|
||||
m_localUrlMapping[ dirquery.value( 0 ).toString() ] = dirquery.value( 1 ).toString();;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -136,15 +132,14 @@ DatabaseCommand_DeleteFiles::exec( DatabaseImpl* dbi )
|
||||
}
|
||||
else if ( !m_ids.isEmpty() )
|
||||
{
|
||||
delquery.prepare( QString( "DELETE FROM file WHERE source %1 AND url IN ( ? )" )
|
||||
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) ) );
|
||||
delquery.prepare( QString( "DELETE FROM file WHERE source %1 AND %2 IN ( ? )" )
|
||||
.arg( source()->isLocal() ? "IS NULL" : QString( "= %1" ).arg( source()->id() ) )
|
||||
.arg( source()->isLocal() ? "id" : "url" ) );
|
||||
|
||||
QString idstring;
|
||||
foreach( const QVariant& id, m_ids )
|
||||
{
|
||||
if ( source()->isLocal() )
|
||||
idstring.append( '"' + m_localUrlMapping[ id.toString() ] + "\", " );
|
||||
else
|
||||
idstring.append( '"' + id.toString() + "\", " );
|
||||
}
|
||||
idstring.chop( 3 ); //remove the trailing "\", "
|
||||
|
@@ -79,7 +79,6 @@ private:
|
||||
QDir m_dir;
|
||||
QVariantList m_ids;
|
||||
bool m_deleteAll;
|
||||
QHash< QString, QString > m_localUrlMapping;
|
||||
};
|
||||
|
||||
#endif // DATABASECOMMAND_DELETEFILES_H
|
||||
|
Reference in New Issue
Block a user