xbmc/xbmc — pull request #804 by jmarshallnz (2012-03-23 03:45:54+00:00)
Title: Get rid of LIKE clauses for path matching as mysql has issues with slash escaping otherwise

When presented with a LIKE clause, mysql first parses the string, which treats any backslashes as escape characters. This means any DOS paths will screw up: They'll be correctly added to the database, but a LIKE clause on the exact same string will not match due to the escaping.

The simple solution is to use = clauses instead of LIKE clauses. This is easy in most cases as we match on exact paths.

Where it isn't quite so easy is when we want to match subpaths. We do this by employing the SUBSTR() function, which takes in utf8 character lengths, rather than byte lengths.

Note that this hasn't as yet been fully tested on win32 mysql (earlier versions of the same patch have been tested) so if anyone happens to have such a setup, please test.