BUGFIX MySQLDatabase->decimal() was being casted as an integer, when in actual fact the precision could be "9,2", for example

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@71891 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-02-16 03:42:37 +00:00
parent 0f1cf8899a
commit 0b9db33164

View File

@ -468,8 +468,15 @@ class MySQLDatabase extends Database {
//For reference, this is what typically gets passed to this function:
//$parts=Array('datatype'=>'decimal', 'precision'=>"$this->wholeSize,$this->decimalSize");
//DB::requireField($this->tableName, $this->name, "decimal($this->wholeSize,$this->decimalSize)");
// Avoid empty strings being put in the db
if($values['precision'] == '') {
$precision = 1;
} else {
$precision = $values['precision'];
}
return 'decimal(' . (int)$values['precision'] . ') not null';
return 'decimal(' . $precision . ') not null';
}
/**