mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Changing a bit how postgres driver treats booleans so it correcty casts them
This commit is contained in:
parent
da152e0e82
commit
1d530db39b
1 changed files with 6 additions and 5 deletions
|
@ -162,7 +162,6 @@ class DboPostgres extends DboSource {
|
||||||
$result = $this->_execute($sql, array($schema));
|
$result = $this->_execute($sql, array($schema));
|
||||||
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$result->closeCursor();
|
|
||||||
return array();
|
return array();
|
||||||
} else {
|
} else {
|
||||||
$tables = array();
|
$tables = array();
|
||||||
|
@ -248,7 +247,9 @@ class DboPostgres extends DboSource {
|
||||||
$this->_sequenceMap[$table][$model->primaryKey] = $model->sequence;
|
$this->_sequenceMap[$table][$model->primaryKey] = $model->sequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cols->closeCursor();
|
if ($cols) {
|
||||||
|
$cols->closeCursor();
|
||||||
|
}
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -706,7 +707,7 @@ class DboPostgres extends DboSource {
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'bool':
|
case 'bool':
|
||||||
$resultRow[$table][$column] = $this->boolean($row[$index], false);
|
$resultRow[$table][$column] = $this->boolean($row[$index]);
|
||||||
break;
|
break;
|
||||||
case 'binary':
|
case 'binary':
|
||||||
case 'bytea':
|
case 'bytea':
|
||||||
|
@ -731,7 +732,7 @@ class DboPostgres extends DboSource {
|
||||||
* @param boolean $quote true to quote a boolean to be used in a query, flase to return the boolean value
|
* @param boolean $quote true to quote a boolean to be used in a query, flase to return the boolean value
|
||||||
* @return boolean Converted boolean value
|
* @return boolean Converted boolean value
|
||||||
*/
|
*/
|
||||||
function boolean($data, $quote = true) {
|
function boolean($data, $quote = false) {
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case ($data === true || $data === false):
|
case ($data === true || $data === false):
|
||||||
$result = $data;
|
$result = $data;
|
||||||
|
@ -753,7 +754,7 @@ class DboPostgres extends DboSource {
|
||||||
if ($quote) {
|
if ($quote) {
|
||||||
return ($result) ? 'TRUE' : 'FALSE';
|
return ($result) ? 'TRUE' : 'FALSE';
|
||||||
}
|
}
|
||||||
return (int) $result;
|
return (bool) $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue