Skip to content

Commit

Permalink
Convert bool values on object retrieval only for postgresql.
Browse files Browse the repository at this point in the history
git-svn-id: http://voip.null.ro/svn/ansql/trunk@280 dbfed7de-b0aa-0410-b6a1-c7e608b77fc9
  • Loading branch information
dana committed Feb 16, 2017
1 parent be2719b commit 77675bb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -3262,6 +3262,7 @@ public function makeInnerQuery($inner_query=array(), $table = NULL, $where='')
protected function populateObject($result)
{
Debug::func_start(__METHOD__,func_get_args(),"framework");
global $db_type;

if(count($result) != 1)
{
Expand All @@ -3273,7 +3274,7 @@ protected function populateObject($result)
$allow_html = $this->allowHTML();
foreach($result[0] as $var_name=>$value) {
$var = $this->getVariable(get_class($this),$var_name);
if ($var && $var->_type == "bool") {
if ($db_type == "postgresql" && $var && $var->_type == "bool") {
if ($value == "1")
$value = "t";
elseif ($value == "0")
Expand All @@ -3293,6 +3294,7 @@ protected function populateObject($result)
protected function buildArrayOfObjects($result)
{
Debug::func_start(__METHOD__,func_get_args(),"framework");
global $db_type;

if(!count($result))
return array();
Expand All @@ -3309,7 +3311,7 @@ protected function buildArrayOfObjects($result)
$clone->_model = $this->_model;
foreach ($row as $var_name=>$value) {
$var = $clone->getVariable($class_name,$var_name);
if ($var && $var->_type == "bool") {
if ($db_type == "postgresql" && $var && $var->_type == "bool") {
if ($value == "1")
$value = "t";
elseif ($value == "0")
Expand Down

0 comments on commit 77675bb

Please sign in to comment.