Hello Everyone;
I’ve got a really weird situation.
I’ve started using DAO queries since a couple of weeks to improve the performance.
Today I started coding a really stupid action that should do nothing but return a set of elements in JSON format.
the code is something like this:
    public function actionCheckrefs() {
        $connection = Yii::app()->db;
        if (!$connection->getAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY))
            $connection->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
        $failedItems = array();
        $sql = 'SELECT ID, thumb_URL, selling_end_date FROM '.Items::model()->tableName().' LIMIT '.$_GET['start'].', '.$_GET['amount'];
        $itemsList = $connection->createCommand($sql)->query();
        // other harmless stuff
        Utils::outputJson(array('items'=>$failedItems))
    }
now I started getting mad because at the beginning the ouputJson function was never reached, with no errors whatsoever. So I started placing echo "ok"; die(); and move it line by line, stupid way but at least I could find where the error was.
it was actually triggering on
CDbCommand::query()
so I tried to dig a little further and found that the error was actually on line 115 of CDbCommand.php :
				$this->_statement=$this->getConnection()->getPdoInstance()->prepare($this->getText());
A.K.A. the prepare statement.
I tried to do an idiotic test action:
    public function actionTest() {
        $pdo = new PDO($init,$user,$pwd, array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true));
        $pdo->prepare('SELECT ID, thumb_URL, selling_end_date FROM '.Items::model()->tableName());
        echo "ok";
        if (!Yii::app()->db->getAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY))
            Yii::app()->db->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
        Yii::App()->db->getPdoInstance()->prepare('SELECT ID, thumb_URL, selling_end_date FROM '.Items::model()->tableName().' LIMIT 0,30');
        echo "ok2";
    }
that unexpectedly returned me "okok2"
This bug is really getting me mad since I cannot replicate on my local machine with php 5.2.12 + PDO Mysql 5.0.90
While the online machine is a sun solaris with php 5.2.5 and PDO Mysql 5.0.51
I even found a bug but I cannot get the trace for it unfortunately (not enough rights to do that): http://bugs-beta.php.net/bug.php?id=37445
Please someone enlighten me!