The fix for 100% CPU while searching in Collection Browser
Dr. Diesel
dr.diesel at gmail.com
Sat Mar 8 15:05:42 UTC 2008
Here is a very minor change to collectiondb.cpp, I believe it is a
valid change. I've been using it for a while now with no issues.
Please consider stuffing it into the stable trunk.
Function starting at line 2484, current SVN. The only change was the
addition of DISTINCT to each query.
QStringList
CollectionDB::albumListOfArtist( const QString &artist, bool
withUnknown, bool withCompilations )
{
if (getDbConnectionType() == DbConnection::postgresql)
{
return query( "SELECT DISTINCT album.name, lower( album.name )
AS __discard FROM tags, album, artist WHERE "
"tags.album = album.id AND tags.artist = artist.id "
"AND lower(artist.name) = lower('" +
escapeString( artist ) + "') " +
( withUnknown ? QString::null : "AND album.name
<> '' " ) +
( withCompilations ? QString::null : "AND
tags.sampler = " + boolF() ) + deviceidSelection() +
" ORDER BY lower( album.name );" );
}
// mysql is case insensitive and lower() is very slow
else if (getDbConnectionType() == DbConnection::mysql)
{
return query( "SELECT DISTINCT album.name FROM tags, album,
artist WHERE "
"tags.album = album.id AND tags.artist = artist.id "
"AND artist.name = '" + escapeString( artist ) + "' " +
( withUnknown ? QString::null : "AND album.name
<> '' " ) +
( withCompilations ? QString::null : "AND
tags.sampler = " + boolF() ) + deviceidSelection() +
" ORDER BY album.name;" );
}
else // sqlite
{
return query( "SELECT DISTINCT album.name FROM tags, album,
artist WHERE "
"tags.album = album.id AND tags.artist = artist.id "
"AND lower(artist.name) = lower('" +
escapeString( artist ) + "') " +
( withUnknown ? QString::null : "AND album.name
<> '' " ) +
( withCompilations ? QString::null : "AND
tags.sampler = " + boolF() ) + deviceidSelection() +
" ORDER BY lower( album.name );" );
}
}
Thanks
Andy
--
projecthuh.com
All of my bits are free, are yours? Fedoraproject.org
More information about the Amarok
mailing list