mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Applying patch from 'kworr' to reorder the switch in DboPostgres::value() to fix issues with pgsql 9.0. Fixes #1139
This commit is contained in:
parent
8cd266c77f
commit
a4746c7227
1 changed files with 11 additions and 11 deletions
|
@ -299,6 +299,17 @@ class DboPostgres extends DboSource {
|
|||
}
|
||||
|
||||
switch($column) {
|
||||
case 'binary':
|
||||
$data = pg_escape_bytea($data);
|
||||
break;
|
||||
case 'boolean':
|
||||
if ($data === true || $data === 't' || $data === 'true') {
|
||||
return 'TRUE';
|
||||
} elseif ($data === false || $data === 'f' || $data === 'false') {
|
||||
return 'FALSE';
|
||||
}
|
||||
return (!empty($data) ? 'TRUE' : 'FALSE');
|
||||
break;
|
||||
case 'float':
|
||||
if (is_float($data)) {
|
||||
$data = sprintf('%F', $data);
|
||||
|
@ -312,17 +323,6 @@ class DboPostgres extends DboSource {
|
|||
if ($data === '') {
|
||||
return $read ? 'NULL' : 'DEFAULT';
|
||||
}
|
||||
case 'binary':
|
||||
$data = pg_escape_bytea($data);
|
||||
break;
|
||||
case 'boolean':
|
||||
if ($data === true || $data === 't' || $data === 'true') {
|
||||
return 'TRUE';
|
||||
} elseif ($data === false || $data === 'f' || $data === 'false') {
|
||||
return 'FALSE';
|
||||
}
|
||||
return (!empty($data) ? 'TRUE' : 'FALSE');
|
||||
break;
|
||||
default:
|
||||
$data = pg_escape_string($data);
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue