Improved boolean field handling for postgres

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@66792 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-11-27 00:00:35 +00:00
parent 5404cd3016
commit 1ad0bfb165

View File

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