mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
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:
parent
acc79fe0f3
commit
3ff5bfa829
3 changed files with 9 additions and 9 deletions
|
@ -147,10 +147,9 @@ class DboFirebird extends DboSource {
|
||||||
/**
|
/**
|
||||||
* Returns a row from given resultset as an array .
|
* 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
|
* @return array The fetched row as an array
|
||||||
*/
|
*/
|
||||||
function fetchRow($assoc = false) {
|
function fetchRow() {
|
||||||
if (is_resource($this->_result)) {
|
if (is_resource($this->_result)) {
|
||||||
$this->resultSet($this->_result);
|
$this->resultSet($this->_result);
|
||||||
$resultRow = $this->fetchResult();
|
$resultRow = $this->fetchResult();
|
||||||
|
|
|
@ -232,12 +232,7 @@ class DboPostgres extends DboSource {
|
||||||
|
|
||||||
switch($column) {
|
switch($column) {
|
||||||
case 'inet':
|
case 'inet':
|
||||||
if (!strlen($data)) {
|
case 'float':
|
||||||
return 'DEFAULT';
|
|
||||||
} else {
|
|
||||||
$data = pg_escape_string($data);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'integer':
|
case 'integer':
|
||||||
if ($data === '') {
|
if ($data === '') {
|
||||||
return 'DEFAULT';
|
return 'DEFAULT';
|
||||||
|
@ -247,7 +242,6 @@ class DboPostgres extends DboSource {
|
||||||
break;
|
break;
|
||||||
case 'binary':
|
case 'binary':
|
||||||
$data = pg_escape_bytea($data);
|
$data = pg_escape_bytea($data);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -193,6 +193,13 @@ class DboPostgresTest extends CakeTestCase {
|
||||||
$this->assertEqual($this->db->column('time without time zone'), 'time');
|
$this->assertEqual($this->db->column('time without time zone'), 'time');
|
||||||
$this->assertEqual($this->db->column('timestamp without time zone'), 'datetime');
|
$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'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue