jok3r
(Joker Odessa)
1
Hello. After loading model with AR and saving it (nothing changed) i have CDbException:
Error: column "x" is of type boolean but expression is of type integer
$model = MyModel::model()->findByPk($id);
$model->save();
and
$model = MyModel::model()->findByPk($id);
if($model->x)
$model->x = 'true';
else
$model->x = 'false';
$model->save();
works
Yii: v1.1.10
PHP: 5.4
Postgresql: 9.1.4
At the host with PHP 5.3 and Postgresql 8.2 there are any probles with it;
jok3r
(Joker Odessa)
2
So, it’s a strange bug.
I’ve made fix in CDbConnection
//'boolean'=>PDO::PARAM_BOOL,
'boolean'=>PDO::PARAM_STR,
And now it’s work good.
But
$sql = 'update xxx set ttt = :yyy where id = :zzz';
$s = $db->prepare($sql);
$val = 1;
$s->bindParam(':yyy',$val);
$s->bindParam(':zzz',$val,PDO::PARAM_INT);
$s->execute();
Generates ‘t’
and
$sql = 'update xxx set ttt = :yyy where id = :zzz';
$s = $db->prepare($sql);
$val = 1;
$s->bindParam(':yyy',$val, PDO::PARAM_BOOL);
$s->bindParam(':zzz',$val,PDO::PARAM_INT);
$s->execute();
Also generates ‘t’.
So it’s a PDO bug or Yii bug?