mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
0f1cf8899a
commit
0b9db33164
@ -468,8 +468,15 @@ class MySQLDatabase extends Database {
|
|||||||
//For reference, this is what typically gets passed to this function:
|
//For reference, this is what typically gets passed to this function:
|
||||||
//$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)");
|
||||||
|
|
||||||
|
// 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';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user