Changing a bit how postgres driver treats booleans so it correcty casts them

This commit is contained in:
José Lorenzo Rodríguez 2011-01-01 22:09:22 -04:30
parent da152e0e82
commit 1d530db39b

View file

@ -162,7 +162,6 @@ class DboPostgres extends DboSource {
$result = $this->_execute($sql, array($schema));
if (!$result) {
$result->closeCursor();
return array();
} else {
$tables = array();
@ -248,7 +247,9 @@ class DboPostgres extends DboSource {
$this->_sequenceMap[$table][$model->primaryKey] = $model->sequence;
}
if ($cols) {
$cols->closeCursor();
}
return $fields;
}
@ -706,7 +707,7 @@ class DboPostgres extends DboSource {
switch ($type) {
case 'bool':
$resultRow[$table][$column] = $this->boolean($row[$index], false);
$resultRow[$table][$column] = $this->boolean($row[$index]);
break;
case 'binary':
case 'bytea':
@ -731,7 +732,7 @@ class DboPostgres extends DboSource {
* @param boolean $quote true to quote a boolean to be used in a query, flase to return the boolean value
* @return boolean Converted boolean value
*/
function boolean($data, $quote = true) {
function boolean($data, $quote = false) {
switch (true) {
case ($data === true || $data === false):
$result = $data;
@ -753,7 +754,7 @@ class DboPostgres extends DboSource {
if ($quote) {
return ($result) ? 'TRUE' : 'FALSE';
}
return (int) $result;
return (bool) $result;
}
/**