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:
Geoff Munn 2009-10-01 21:03:52 +00:00
parent 7eb3cf66e8
commit ddfc0613ad
4 changed files with 20 additions and 7 deletions

View File

@ -57,10 +57,14 @@ class Boolean extends DBField {
* If necessary, this should include quotes.
*/
function prepValueForDB($value) {
if($value && strtolower($value) != 'f') {
return "'1'";
} else {
return "'0'";
if(strpos($value, '[')!==false)
return addslashes($value);
else {
if($value && strtolower($value) != 'f') {
return "'1'";
} else {
return "'0'";
}
}
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}