Big Varbinary Column (Mssql)

Hi all.

Work with MSSQL, using pdo_sqlsrv driver(PHP 5.4.8).

In my DB I have column with varbinary type and size of it == 7584.

When I try get value from this column I get error "Invalid sql_display_size in G:\…\…\…\framework\yiilite.php on line 8836".

Here query:




$model = Character::model()->find(array(

            'select'=>'Inventory',

            'condition'=>'Name=:Name',

            'params'=>array(':Name'=>'JohnDoe')

        ));



Maybe someone encountered this problem and can help me.

P.S. Sorry for my bad english)

I think this is a PDO MSSQL driver and not Yii bug according to

https://bugs.php.net/bug.php?id=55083

But last update of mssql drivers was 10/03/2012 I hope they fixed bugs like this, now I think problem in other.

If it is true and there are no solution it’s very sad).

I agree with you that is very sad if it is a bug of PDO

Please send a bug report to

https://bugs.php.net/report.php

I found solution for my situation. But…

Here query:




 DECLARE @item varbinary(1728); SET @item = (SELECT Inventory FROM Character WHERE Name='CharName'); print @item;



In this case I get exactly that size that I need. It work in normal php query (not PDO) and in MSSQL Managment Studio.

When I run this code in Yii:


        

$query = "DECLARE @item varbinary(1728); SET @item = (SELECT Inventory FROM Character WHERE Name='CharName'); print @item";

$command=Yii::app()->db->createCommand($query)->query();

$command->read();



I get this:

I think that I wrong built query.

My question how run query like this in Yii.

Check the below links

http://social.msdn.microsoft.com/Forums/en/sqldriverforphp/thread/fd6015cd-d42f-470d-b8c7-ae9e6786f59c

@smokeelow:

Did you ever find a solution for your question? Please let me know.

Thanks,