Skip to content

Commit

Permalink
Bug fix when checking for modified columns: bool true value can appea…
Browse files Browse the repository at this point in the history
…r as 1,'1','t',true.

git-svn-id: http://voip.null.ro/svn/ansql/trunk@204 dbfed7de-b0aa-0410-b6a1-c7e608b77fc9
  • Loading branch information
monica committed Feb 10, 2016
1 parent a22194e commit 883738a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,11 @@ public function setParams($params)
$this->_modified_col = array();

foreach($params as $param_name=>$param_value) {
if($this->variable($param_name)) {
$var = $this->variable($param_name);
if ($var) {
if($var->_type=="bool")
$param_value = Model::sqlBool($param_value);

if($this->{$param_name} != $param_value)
$this->_modified_col[$param_name] = true;
$this->{$param_name} = $param_value;
Expand Down Expand Up @@ -2343,9 +2347,9 @@ public static function sqlBool($value, $defval = 'NULL')
{
Debug::func_start(__METHOD__,func_get_args(),"framework");

if (($value === true) || ($value === 't'))
if ($value===true || $value==='t' || $value==='1' || $value===1)
return 't';
if (($value === false) || ($value === 'f'))
if ($value===false || $value==='f' || $value==='0' || $value===0)
return 'f';
return $defval;
}
Expand Down

0 comments on commit 883738a

Please sign in to comment.