Fixed reading of booleans in postgres

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@66432 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-11-23 23:49:25 +00:00
parent 93438e0be2
commit 09e3145921

View File

@ -129,6 +129,15 @@ class DataObject extends ViewableData implements DataObjectInterface,i18nEntityP
$record = null;
}
// Convert PostgreSQL boolean values
// TODO: Implement this more elegantly, for example by writing a more intelligent SQL SELECT query prior to object construction
if(DB::getConn() instanceof PostgreSQLDatabase) {
$this->class = get_class($this);
foreach($record as $k => $v) {
if($this->db($k) == 'Boolean' && $v == 'f') $record[$k] = '0';
}
}
$this->record = $this->original = $record;
// Keep track of the modification date of all the data sourced to make this page