Skip to content
Permalink
Browse files

DboMssql::value() now returns NULL for numeric column types (float, i…

…nteger, binary) when the column data is empty. Fixes #28.
  • Loading branch information...
jperras committed Sep 6, 2009
1 parent bcbdb1c commit 2484179e3600485480e65ab18b5f37448610337a
@@ -259,6 +259,9 @@ function value($data, $column = null, $safe = false) {
if ($data === null) {
return 'NULL';
}
if (in_array($column, array('integer', 'float', 'binary')) && $data === '') {
return 'NULL';
}
if ($data === '') {
return "''";
}
@@ -345,6 +345,18 @@ function testQuoting() {
$expected = "'1,2'";
$result = $this->db->value('1,2', 'float');
$this->assertIdentical($expected, $result);
$expected = 'NULL';
$result = $this->db->value('', 'integer');
$this->assertIdentical($expected, $result);
$expected = 'NULL';
$result = $this->db->value('', 'float');
$this->assertIdentical($expected, $result);
$expected = 'NULL';
$result = $this->db->value('', 'binary');
$this->assertIdentical($expected, $result);
}
/**
* testFields method

0 comments on commit 2484179

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.