Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-122

Impossible to save data to image/binary/varbinary

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Can't Fix
    • Affects Version/s: 2.0.4
    • Fix Version/s: None
    • Component/s: Platforms
    • Labels:
      None
    • Environment:
      XAMP, MsSQL-Server 2008, PHP 5.3.x, MS pdo_sqlsrv_vc6_ts.dll

      Description

      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 (http://207.46.16.252/de-de/library/ms187928.aspx):

      *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

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: