Uploaded image for project: 'Doctrine DBAL'
  1. Doctrine DBAL
  2. DBAL-122

Impossible to save data to image/binary/varbinary


    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Can't Fix
    • Affects Version/s: 2.0.4
    • Fix Version/s: None
    • Component/s: Platforms
    • Labels:
    • Environment:
      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 'binary' or 'varbinary' the error message is:
      => Implicit conversion from nvarchar(max) datatype to varbinary(max) is not allowed.

      When trying to insert into 'image' the error message is:
      => Operand collision: nvarchar(max) is incompatible with image.

      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),
      or in the datatype mapping which is to 'text'.

      The documentation for the MsSQLServer states following conversions (

      *char => binary/varbinary : Explicit conversion
      nchar/nvarchar => image : IMPOSSIBLE

      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.

        Issue Links



            • Assignee:
              deeky666 Steve Müller
              le_shatai Martin Weise
            • Votes:
              0 Vote for this issue
              4 Start watching this issue


              • Created: