API CHANGE: Change the way that Database::requireField() gets field type information from the underlying database driver. (from r82793)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@89708 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-10-21 02:15:29 +00:00
parent b07e4e5181
commit b117becef5

View File

@ -411,8 +411,8 @@ abstract class Database {
// backwards compatibility patch for pre 2.4 requireField() calls
$spec_orig=$spec;
if(!is_string($spec)) {
// TODO: This is tempororary
$spec['parts']['name'] = $field;
$spec_orig['parts']['name'] = $field;
//Convert the $spec array into a database-specific string
@ -432,12 +432,11 @@ abstract class Database {
$this->fieldList[$table] = $this->fieldList($table);
}
// Get the value of this field.
if(is_array($spec)){
$specValue=$spec['data_type'];
if(isset($spec['precision']))
$specValue.='(' . $spec['precision'] . ')';
} else $specValue=$spec;
if(is_array($spec)) {
$specValue = DB::getConn()->$spec_orig['type']($spec_orig['parts']);
} else {
$specValue = $spec;
}
// We need to get db-specific versions of the ID column:
if($spec_orig==DB::getConn()->IdColumn() || $spec_orig==DB::getConn()->IdColumn(true))
@ -500,7 +499,7 @@ abstract class Database {
Profiler::mark('alterField');
$this->transAlterField($table, $field, $spec_orig);
Profiler::unmark('alterField');
Database::alteration_message("Field $table.$field: changed to $spec_orig <i style=\"color: #AAA\">(from {$fieldValue})</i>","changed");
Database::alteration_message("Field $table.$field: changed to $specValue <i style=\"color: #AAA\">(from {$fieldValue})</i>","changed");
}
Profiler::unmark('requireField');
}