Fixing default value for float columns in Postgres, fixes #3963

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6564 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2008-03-13 03:06:14 +00:00
parent acc79fe0f3
commit 3ff5bfa829
3 changed files with 9 additions and 9 deletions

View file

@ -147,10 +147,9 @@ class DboFirebird extends DboSource {
/**
* Returns a row from given resultset as an array .
*
* @param boolean $assoc Associative array only, or both?
* @return array The fetched row as an array
*/
function fetchRow($assoc = false) {
function fetchRow() {
if (is_resource($this->_result)) {
$this->resultSet($this->_result);
$resultRow = $this->fetchResult();

View file

@ -232,12 +232,7 @@ class DboPostgres extends DboSource {
switch($column) {
case 'inet':
if (!strlen($data)) {
return 'DEFAULT';
} else {
$data = pg_escape_string($data);
}
break;
case 'float':
case 'integer':
if ($data === '') {
return 'DEFAULT';
@ -247,7 +242,6 @@ class DboPostgres extends DboSource {
break;
case 'binary':
$data = pg_escape_bytea($data);
break;
case 'boolean':
default:

View file

@ -193,6 +193,13 @@ class DboPostgresTest extends CakeTestCase {
$this->assertEqual($this->db->column('time without time zone'), 'time');
$this->assertEqual($this->db->column('timestamp without time zone'), 'datetime');
}
function testValueQuoting() {
$this->assertEqual($this->db->value('0', 'integer'), "'0'");
$this->assertEqual($this->db->value('', 'integer'), "DEFAULT");
$this->assertEqual($this->db->value('', 'float'), "DEFAULT");
$this->assertEqual($this->db->value('0.0', 'float'), "'0.0'");
}
}
?>