silverstripe/sapphire — pull request #252 by halkyon (2012-03-20 08:36:01+00:00)
Title: Adding Database::prepStringForDB() to allow MSSQLDatabase to prepare string for unicode

Introduce a new method prepStringForDB on the Database class, allowing an adapter to overload and modify the preparation if required.

MSSQL requires values to be enclosed with an N prefix to allow unicode characters like macrons to be saved to the database correctly. e.g. "Title" = N'makrón' instead of "Title" = 'makrón'. The latter example works fine in any other database, except MSSQL, which won't save the macron correctly. This pull request will allow MSSQLDatabase (from the silverstripe-mssql module) to overload the default string prep and include the N prefix to resolve the situation with unicode characters.