Skip to content
Permalink
Browse files

Fixing issues in postgres with time columns and '' values.

Tests added.
Fixes #213
  • Loading branch information...
markstory committed Oct 27, 2009
1 parent 79fdd8b commit 5a093e56272d614c7bb33adee0eb4dfd3cc701c1
@@ -286,6 +286,7 @@ function value($data, $column = null, $read = true) {
case 'date':
case 'datetime':
case 'timestamp':
case 'time':
if ($data === '') {
return $read ? 'NULL' : 'DEFAULT';
}
@@ -291,11 +291,11 @@ function testValueQuoting() {
$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 @@ function testDateAsNull() {
$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

0 comments on commit 5a093e5

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.