DAO: starange beahviour, bug or something else

Salutations.

I have a problem with DAO or maybe somewhere else

below is the simplified example from real app




        $db = Yii::app()->db;

        $command = $db->createCommand('SELECT * FROM `Job` WHERE `sig`=:sig');

        $sig = '63732b44ae3f8f40de00ac6c27cc0ae1b7999aeddcea60af04398e806ef0afea';

        $command->bindParam(':sig',$sig, PDO::PARAM_STR);

        $data = $command->queryRow();

        CVarDumper::dump($data, 10, true);



this example doesn’t work. I get “false”.

Examples below work fine




        $db = Yii::app()->db;

        $command = $db->createCommand('SELECT * FROM Job WHERE sig=\'63732b44ae3f8f40de00ac6c27cc0ae1b7999aeddcea60af04398e806ef0afea\'');

        $data = $command->queryRow();

        CVarDumper::dump($data, 10, true);


        // or


        $db = Yii::app()->db;

        $command = $db->createCommand('SELECT * FROM `Job`');

        $data = $command->queryRow();

        CVarDumper::dump($data, 10, true);



I have

  • PHP Version 5.3.2-1ubuntu4.2

  • Yii 1.1 (revision 2225)

Can anyone say me what’s wrong with first example? Or how to find workaround for this problem?

thanks

Try bindValue() instead. I also noted some issues with bindParam() and never got it working as i expected it to.

Thanks Mike.

bindValue() works fine.

1.5 or 2 monthes ago this code (first example) worked very well without any problem.

I decided to make some investigations.

BTW three examples above work on x64 platform.

I have another server (x32, PHP version the same) on which I had Yii revision 2180.

I tried bindParam() on this server and found that bindParam() works.

Then I decided revert Yii on the main server to 2180. I thought that this can shed some light… But rev 2180 doesn’t work as I expected.

Then I decided to check direct PDO calls, without Yii wrappers. PDO works fine on both x64 and x32 (PHP Version 5.3.2-1ubuntu4.2).

BTW Yii rev.2231 on the second (x32) server works very well too.

Seems like this is a local issue, but this issue relates to Yii only.

:wink: Sorry for my English.

If you think, it’s yii related, you could create a ticket. But you should describe how to reproduce the problem in detail there.