Merge pull request #506 from halkyon/sapphire

---

In the example, if you have an enum of Enum("Something,Don\t know") in your `DataObject::$db` array, then dev/build will *always* say this field has changed, because `MySQLDatabase::showFields()` returns the escaped string specification of the field with  instead of \.

This converts the field spec so that  is escaped to \ correctly so the change detection in `Database` is correct.
This commit is contained in:
Ingo Schommer 2012-06-07 12:35:10 +02:00
commit 013abcbe8b

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';
}