Skip to content
This repository
Browse code

BUGFIX Ensure that enum values with a single quote are escaped correc…

…tly for PHP coming out of MySQL ('' to \'), otherwise dev/build shows these as changed all the time.
  • Loading branch information...
commit 13be7cb2b98453efae2952b4879bfd557806b702 1 parent b4fb174
Sean Harvey authored June 06, 2012

Showing 1 changed file with 3 additions and 1 deletion. Show diff stats Hide diff stats

  1. 4  model/MySQLDatabase.php
4  model/MySQLDatabase.php
@@ -367,7 +367,9 @@ public function renameField($tableName, $oldName, $newName) {
367 367
 	public function fieldList($table) {
368 368
 		$fields = DB::query("SHOW FULL FIELDS IN \"$table\"");
369 369
 		foreach($fields as $field) {
370  
-			$fieldSpec = $field['Type'];
  370
+
  371
+			// ensure that '' is converted to \' in field specification (mostly for the benefit of ENUM values)
  372
+			$fieldSpec = str_replace('\'\'', '\\\'', $field['Type']);
371 373
 			if(!$field['Null'] || $field['Null'] == 'NO') {
372 374
 				$fieldSpec .= ' not null';
373 375
 			}

0 notes on commit 13be7cb

Please sign in to comment.
Something went wrong with that request. Please try again.