Smart playlist bug
Tobias Knieper
tobias.knieper at gmail.com
Sat Jan 20 14:20:46 UTC 2007
Hello Felix,
thanks for the patch. I tested it and everything seems to work fine. Next time
you have a patch please file a bug report at bugs.kde.org and attach the
patch there.
Best regards,
Tobias
On Saturday 20 January 2007 02:38, Felix Rotthowe wrote:
> Hello there,
>
> today I tried to create a smart playlist (using current svn version)
> with all non rated songs and noticed that this doesn't work because
> it contained ALL songs of my collection. After a little research, I
> found out that the generated SQL query contains the substring
> "COALESCE(statistics.rating,0) <> '0' ", which seems to be wrong
> because statistics.rating is supposed to be an integer value rather
> than a string.
>
> I first searched the problem inside
> CriteriaEditor::getSearchCriteria, but soon found out this method is
> never used (in fact, I deleted it and amarok compiled without
> complaints).
> After that, I noticed amarok is using xml based playlists, from which
> the sql query is build. Inside QueryBuilder::excludeFilter I found
> the following code:
>
> if (exact)
> s = " <> '" + CollectionDB::instance()->escapeString( filter ) +
> "' ";
>
> Because the filter string comes from the xml playlist description, at
> this point there is no information wheter it was a numeric or string
> value. Nevertheless, the following code should be ok with all queries
> because sqlite converts numbers to strings if the are matched against
> another string value (so for example an artist called 666 would be
> excluded although the isNumber check succeeds).
>
> if (exact) {
> bool isNumber;
> filter.toInt( &isNumber );
> if (isNumber) {
> s = " <> " + CollectionDB::instance()->escapeString
> ( filter ) + " ";
> } else {
> s = " <> '" + CollectionDB::instance()->escapeString
> ( filter ) + "' ";
> }
> }
>
> This fixed the bug for me. Please let me know if this was the right
> place to change the code, because I've just started exploring the
> amarok sources.
>
> Greetings,
> Felix
> _______________________________________________
> Amarok mailing list
> Amarok at kde.org
> https://mail.kde.org/mailman/listinfo/amarok
More information about the Amarok
mailing list