BUGFIX Ensure that enum values with a single quote are escaped correctly for PHP coming out of MySQL ('' to \'), otherwise dev/build shows these as changed all the time.

This commit is contained in:
Sean Harvey 2012-06-06 10:30:29 +12:00
parent b4fb174809
commit 13be7cb2b9

View File

@ -367,7 +367,9 @@ class MySQLDatabase extends SS_Database {
public function fieldList($table) {
$fields = DB::query("SHOW FULL FIELDS IN \"$table\"");
foreach($fields as $field) {
$fieldSpec = $field['Type'];
// ensure that '' is converted to \' in field specification (mostly for the benefit of ENUM values)
$fieldSpec = str_replace('\'\'', '\\\'', $field['Type']);
if(!$field['Null'] || $field['Null'] == 'NO') {
$fieldSpec .= ' not null';
}