mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR CHANGE: numeric datatypes changed to support array types
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@87895 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
7eb3cf66e8
commit
ddfc0613ad
@ -57,12 +57,16 @@ class Boolean extends DBField {
|
||||
* If necessary, this should include quotes.
|
||||
*/
|
||||
function prepValueForDB($value) {
|
||||
if(strpos($value, '[')!==false)
|
||||
return addslashes($value);
|
||||
else {
|
||||
if($value && strtolower($value) != 'f') {
|
||||
return "'1'";
|
||||
} else {
|
||||
return "'0'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function nullValue() {
|
||||
return "'0'";
|
||||
|
@ -55,7 +55,10 @@ class Decimal extends DBField {
|
||||
if($value === true) {
|
||||
return 1;
|
||||
} if(!$value || !is_numeric($value)) {
|
||||
return "0";
|
||||
if(strpos($value, '[')===false)
|
||||
return '0';
|
||||
else
|
||||
return addslashes($value);
|
||||
} else {
|
||||
return addslashes($value);
|
||||
}
|
||||
|
@ -36,7 +36,10 @@ class Float extends DBField {
|
||||
if($value === true) {
|
||||
return 1;
|
||||
} if(!$value || !is_numeric($value)) {
|
||||
return "0";
|
||||
if(strpos($value, '[')===false)
|
||||
return '0';
|
||||
else
|
||||
return addslashes($value);
|
||||
} else {
|
||||
return addslashes($value);
|
||||
}
|
||||
|
@ -50,7 +50,10 @@ class Int extends DBField {
|
||||
if($value === true) {
|
||||
return 1;
|
||||
} if(!$value || !is_numeric($value)) {
|
||||
return "0";
|
||||
if(strpos($value, '[')===false)
|
||||
return '0';
|
||||
else
|
||||
return addslashes($value);
|
||||
} else {
|
||||
return addslashes($value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user