Skip to content

Commit

Permalink
BUGFIX Ensure that enum values with a single quote are escaped correc…
Browse files Browse the repository at this point in the history
…tly for PHP coming out of MySQL ('' to \'), otherwise dev/build shows these as changed all the time.
  • Loading branch information
Sean Harvey committed Jun 5, 2012
1 parent b4fb174 commit 13be7cb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion model/MySQLDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,9 @@ public function renameField($tableName, $oldName, $newName) {
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';
}
Expand Down

0 comments on commit 13be7cb

Please sign in to comment.