ENHANCEMENT MSSQLDatabase::decimal() field type now accepts user defined default values if it's available

This commit is contained in:
Sean Harvey 2010-02-03 07:27:50 +00:00
parent 9c1bda45ff
commit b8b85a12a2

View File

@ -872,9 +872,16 @@ class MSSQLDatabase extends SS_Database {
$precision = $values['precision'];
}
if($asDbValue)
return Array('data_type'=>'decimal', 'numeric_precision'=>'9,2');
else return 'decimal(' . $precision . ') not null default 0';
$defaultValue = '0';
if(isset($values['default']) && is_numeric($values['default'])) {
$defaultValue = $values['default'];
}
if($asDbValue) {
return array('data_type'=>'decimal', 'numeric_precision'=>'9,2');
} else {
return 'decimal(' . $precision . ') not null default ' . $defaultValue;
}
}
/**