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

@ -469,7 +469,14 @@ class MySQLDatabase extends Database {
//$parts=Array('datatype'=>'decimal', 'precision'=>"$this->wholeSize,$this->decimalSize"); //$parts=Array('datatype'=>'decimal', 'precision'=>"$this->wholeSize,$this->decimalSize");
//DB::requireField($this->tableName, $this->name, "decimal($this->wholeSize,$this->decimalSize)"); //DB::requireField($this->tableName, $this->name, "decimal($this->wholeSize,$this->decimalSize)");
return 'decimal(' . (int)$values['precision'] . ') not null'; // Avoid empty strings being put in the db
if($values['precision'] == '') {
$precision = 1;
} else {
$precision = $values['precision'];
}
return 'decimal(' . $precision . ') not null';
} }
/** /**