mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
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:
parent
5404cd3016
commit
1ad0bfb165
@ -47,12 +47,10 @@ class Boolean extends DBField {
|
|||||||
* If necessary, this should include quotes.
|
* If necessary, this should include quotes.
|
||||||
*/
|
*/
|
||||||
function prepValueForDB($value) {
|
function prepValueForDB($value) {
|
||||||
if($value === true || $value === 1 || $value === '1') {
|
if($value && strtolower($value) != 'f') {
|
||||||
return "'1'";
|
return "'1'";
|
||||||
} if(!$value || !is_numeric($value)) {
|
|
||||||
return "'0'";
|
|
||||||
} else {
|
} else {
|
||||||
return addslashes($value);
|
return "'0'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user