mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Making DboPostgres::value() return NULL when given an empty array, as DboMysql does
This commit is contained in:
parent
ebde29f63c
commit
75900883e6
2 changed files with 2 additions and 1 deletions
|
@ -286,7 +286,7 @@ class DboPostgres extends DboSource {
|
||||||
return $parent;
|
return $parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($data === null) {
|
if ($data === null || (is_array($data) && empty($data))) {
|
||||||
return 'NULL';
|
return 'NULL';
|
||||||
}
|
}
|
||||||
if (empty($column)) {
|
if (empty($column)) {
|
||||||
|
|
|
@ -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('1', 'boolean'), 'TRUE');
|
$this->assertEqual($this->db2->value('1', 'boolean'), 'TRUE');
|
||||||
$this->assertEqual($this->db2->value(null, 'boolean'), "NULL");
|
$this->assertEqual($this->db2->value(null, 'boolean'), "NULL");
|
||||||
|
$this->assertEqual($this->db2->value(array()), "NULL");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue