[DBAL-122] Impossible to save data to image/binary/varbinary Created: 16/May/11 Updated: 22/Feb/12
|Reporter:||Martin Weise||Assignee:||Benjamin Eberlei|
XAMP, MsSQL-Server 2008, PHP 5.3.x, MS pdo_sqlsrv_vc6_ts.dll
When trying to insert a value into a Column with type 'image', 'binary' or 'varbinary' the SQLServer states that this is not possible.
When trying to insert into 'image' the error message is:
Doctrine prepares the image/binary/varbinary column in the statements as nvarchar(max) which is wrong.
The cause of this error is that in the MsSQLPlatform::getVarcharTypeDeclarationSQLSnippet($length, $fixed),
The documentation for the MsSQLServer states following conversions (http://184.108.40.206/de-de/library/ms187928.aspx):
*char => binary/varbinary : Explicit conversion
So the solution would be, either to leave the datatype blank or use the char/varchar datatype when saving into image/binary/varbinary, which would cause an extra datatype as those would collide with 'text' I guess.
|Comment by Benjamin Eberlei [ 09/Jan/12 ]|
I get the problem, but i don't understand the solutions
Can you explain a bit more?
1. how do i leave a datatype empty? and which one?
I think this is just a problem of unspecific descriptions
|Comment by Martin Weise [ 22/Feb/12 ]|
Sorry, for this long delay.
But it has to be ( removed '-quotes and @P2 changed to varbinary(MAX) ):
I am not really sure any more if this is caused from Doctrine or from the 'MS SQL-Server PHP-PDO-Driver 2.0.1' .
The funny thing is if I do this via executeQuery it works...
Hopefully I could clarify my problem.