diff --git a/cake/libs/model/datasources/dbo/dbo_postgres.php b/cake/libs/model/datasources/dbo/dbo_postgres.php index e5e12d2bc03..540ec0944c1 100644 --- a/cake/libs/model/datasources/dbo/dbo_postgres.php +++ b/cake/libs/model/datasources/dbo/dbo_postgres.php @@ -162,7 +162,6 @@ function listSources($data = null) { $result = $this->_execute($sql, array($schema)); if (!$result) { - $result->closeCursor(); return array(); } else { $tables = array(); @@ -248,7 +247,9 @@ function describe($model) { $this->_sequenceMap[$table][$model->primaryKey] = $model->sequence; } - $cols->closeCursor(); + if ($cols) { + $cols->closeCursor(); + } return $fields; } @@ -706,7 +707,7 @@ function fetchResult() { 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 @@ function fetchResult() { * @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 @@ function boolean($data, $quote = true) { if ($quote) { return ($result) ? 'TRUE' : 'FALSE'; } - return (int) $result; + return (bool) $result; } /**