GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
The current code in the MySQL db wrapper has some logic to replace
cast(foo as integer)
cast(foo as signed integer)
in SQL queries because MySQL doesn't understand the first one (SQLite does). But the logic that takes care of this is only applied once so if there are multiple occurances that need to be fixed only the first is caught and the rest isn't which results in invalid SQL queries on MySQL.
@koying: Would you mind testing this? Easiest is probably to create a smartplaylist for movies and add two rules for the runtime/duration (which is movie.c11 and results in the usage of above SQL snippets).
mysql: replace all "cast(foo as integer)" to "cast(foo as signed inte…
…ger)" and not just the first one
Sorry for late reply.
Does this come from an actual issue or is it a potential one?
Anyway, you produce an endless loop, don't you?
"as signed signed signed ... integer"
It's matching "as integer" which doesn't happen once "signed" is inserted into it.
It's an actual issue with smartplaylists using multiple conditions on playcount, duration or any other integer field. And I don't create an infinite loop because I'm looking for "as integer)" and then replace it with "as signed integer)" so the previous search doesn't match that part anymore.
Yeah, was about to retract the endless loop part ;)
Fine for me.
PS If you prefer an actual test, you'll have to consider me as an end-user as I never used smartplaylists at all ;)
This is the actual ticket: http://trac.xbmc.org/ticket/14496
@koying: an actual test would be nice. Just put http://pastebin.com/UJNUniwU into your userdata/playlists/video/ directory and choose some filename ending with ".xsp". Then go into XBMC, Videos -> Library -> Playlists and open the "randomunplayedmovie" item. Then please check your logs for the appropraite GetMoviesByWhere call for that smartplaylist.
Merge pull request #4331 from Montellese/mysql_integer_cast_fix
mysql: replace all "cast(foo as integer)" to "cast(foo as signed integer)" and not just the first one