mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Fixing issues in postgres with time columns and '' values.
Tests added. Fixes #213
This commit is contained in:
parent
79fdd8b341
commit
5a093e5627
2 changed files with 6 additions and 2 deletions
|
@ -286,6 +286,7 @@ class DboPostgres extends DboSource {
|
|||
case 'date':
|
||||
case 'datetime':
|
||||
case 'timestamp':
|
||||
case 'time':
|
||||
if ($data === '') {
|
||||
return $read ? 'NULL' : 'DEFAULT';
|
||||
}
|
||||
|
|
|
@ -291,11 +291,11 @@ class DboPostgresTest extends CakeTestCase {
|
|||
$this->assertEqual($this->db2->value(null, 'boolean'), "NULL");
|
||||
}
|
||||
/**
|
||||
* test that date columns do not generate errors with null and nullish values.
|
||||
* test that date and time columns do not generate errors with null and nullish values.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function testDateAsNull() {
|
||||
function testDateAndTimeAsNull() {
|
||||
$this->assertEqual($this->db2->value(null, 'date'), 'NULL');
|
||||
$this->assertEqual($this->db2->value('', 'date'), 'NULL');
|
||||
|
||||
|
@ -304,6 +304,9 @@ class DboPostgresTest extends CakeTestCase {
|
|||
|
||||
$this->assertEqual($this->db2->value('', 'timestamp'), 'NULL');
|
||||
$this->assertEqual($this->db2->value(null, 'timestamp'), 'NULL');
|
||||
|
||||
$this->assertEqual($this->db2->value('', 'time'), 'NULL');
|
||||
$this->assertEqual($this->db2->value(null, 'time'), 'NULL');
|
||||
}
|
||||
/**
|
||||
* Tests that different Postgres boolean 'flavors' are properly returned as native PHP booleans
|
||||
|
|
Loading…
Add table
Reference in a new issue