BUGFIX Ensure that values with unicode characters like macrons are saved

to the database correctly. Overload the prepStringForDB() method and
include an "N" prefix.
This commit is contained in:
Sean Harvey 2012-03-21 12:03:11 +13:00
parent 4ae94d286f
commit 375d440677

View File

@ -1568,6 +1568,17 @@ class MSSQLDatabase extends SS_Database {
}
}
/**
* Overload the Database::prepStringForDB() method and include "N" prefix so unicode
* strings are saved to the database correctly.
*
* @param string $string String to be encoded
* @return string Processed string ready for DB
*/
public function prepStringForDB($string) {
return "N'" . Convert::raw2sql($string) . "'";
}
/**
* Function to return an SQL datetime expression for MSSQL
* used for querying a datetime in a certain format