mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
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:
parent
4ae94d286f
commit
375d440677
@ -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
|
* Function to return an SQL datetime expression for MSSQL
|
||||||
* used for querying a datetime in a certain format
|
* used for querying a datetime in a certain format
|
||||||
|
Loading…
Reference in New Issue
Block a user