Skip to content
Permalink
Browse files

Applying patch from 'kworr' to reorder the switch in DboPostgres::val…

…ue() to fix issues with pgsql 9.0. Fixes #1139
  • Loading branch information...
markstory committed Sep 25, 2010
1 parent d12d2d7 commit daeb23ee18de3b5e70620961fc8aeaad22942fcf
Showing with 14 additions and 11 deletions.
  1. +14 −11 cake/libs/model/datasources/dbo/dbo_postgres.php
@@ -284,16 +284,6 @@ function value($data, $column = null, $read = true) {
}
switch($column) {
case 'inet':
case 'float':
case 'integer':
case 'date':
case 'datetime':
case 'timestamp':
case 'time':
if ($data === '') {
return $read ? 'NULL' : 'DEFAULT';
}
case 'binary':
$data = pg_escape_bytea($data);
break;
@@ -305,6 +295,19 @@ function value($data, $column = null, $read = true) {
}
return (!empty($data) ? 'TRUE' : 'FALSE');
break;
case 'float':
if (is_float($data)) {
$data = sprintf('%F', $data);
}
case 'inet':
case 'integer':
case 'date':
case 'datetime':
case 'timestamp':
case 'time':
if ($data === '') {
return $read ? 'NULL' : 'DEFAULT';
}
default:
$data = pg_escape_string($data);
break;
@@ -877,4 +880,4 @@ function renderStatement($type, $data) {
}
}
}
?>
?>

0 comments on commit daeb23e

Please sign in to comment.
You can’t perform that action at this time.