Making DboPostgres::value() return NULL when given an empty array, as DboMysql does

This commit is contained in:
José Lorenzo Rodríguez 2010-03-30 00:01:33 -04:30
parent ebde29f63c
commit 75900883e6
2 changed files with 2 additions and 1 deletions

View file

@ -286,7 +286,7 @@ class DboPostgres extends DboSource {
return $parent;
}
if ($data === null) {
if ($data === null || (is_array($data) && empty($data))) {
return 'NULL';
}
if (empty($column)) {

View file

@ -375,6 +375,7 @@ class DboPostgresTest extends CakeTestCase {
$this->assertEqual($this->db2->value(1, 'boolean'), 'TRUE');
$this->assertEqual($this->db2->value('1', 'boolean'), 'TRUE');
$this->assertEqual($this->db2->value(null, 'boolean'), "NULL");
$this->assertEqual($this->db2->value(array()), "NULL");
}
/**