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