<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Thu May 23 16:48:00 UTC 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://www.doctrine-project.org/jira/si/jira.issueviews:issue-xml/DBAL-122/DBAL-122.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Doctrine Project</title>
    <link>http://www.doctrine-project.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>5.2.7</version>
        <build-number>850</build-number>
        <build-date>21-02-2013</build-date>
    </build-info>

<item>
            <title>[DBAL-122] Impossible to save data to image/binary/varbinary</title>
                <link>http://www.doctrine-project.org/jira/browse/DBAL-122</link>
                <project id="10040" key="DBAL">Doctrine DBAL</project>
                        <description>&lt;p&gt;When trying to insert a value into a Column with type &apos;image&apos;, &apos;binary&apos; or &apos;varbinary&apos; the SQLServer states that this is not possible.&lt;br/&gt;
When trying to insert into &apos;binary&apos; or &apos;varbinary&apos;  the error message is:&lt;br/&gt;
=&amp;gt; Implicit conversion from nvarchar(max) datatype to varbinary(max) is not allowed.&lt;/p&gt;

&lt;p&gt;When trying to insert into &apos;image&apos; the error message is:&lt;br/&gt;
=&amp;gt; Operand collision: nvarchar(max) is incompatible with image.&lt;/p&gt;

&lt;p&gt;Doctrine prepares the image/binary/varbinary column in the statements as  nvarchar(max) which is wrong.&lt;/p&gt;

&lt;p&gt;The cause of this error is that in the MsSQLPlatform::getVarcharTypeDeclarationSQLSnippet($length, $fixed),&lt;br/&gt;
or in the datatype mapping which is to &apos;text&apos;.&lt;/p&gt;

&lt;p&gt;The documentation for the MsSQLServer states following conversions (&lt;a href=&quot;http://207.46.16.252/de-de/library/ms187928.aspx):&quot; class=&quot;external-link&quot;&gt;http://207.46.16.252/de-de/library/ms187928.aspx):&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;*char =&amp;gt; binary/varbinary : Explicit conversion&lt;br/&gt;
nchar/nvarchar =&amp;gt; image : IMPOSSIBLE&lt;/p&gt;

&lt;p&gt;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 &apos;text&apos; I guess.&lt;/p&gt;
</description>
                <environment>XAMP, MsSQL-Server 2008, PHP 5.3.x, MS pdo_sqlsrv_vc6_ts.dll</environment>
            <key id="12637">DBAL-122</key>
            <summary>Impossible to save data to image/binary/varbinary</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="le_shatai">Martin Weise</reporter>
                        <labels>
                    </labels>
                <created>Mon, 16 May 2011 10:54:04 +0000</created>
                <updated>Wed, 22 Feb 2012 16:28:32 +0000</updated>
                                    <version>2.0.4</version>
                                                <component>Platforms</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="17201" author="beberlei" created="Mon, 9 Jan 2012 13:59:25 +0000"  >&lt;p&gt;I get the problem, but i don&apos;t understand the solutions &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;Can you explain a bit more?&lt;/p&gt;

&lt;p&gt;1. how do i leave a datatype empty? and which one?&lt;br/&gt;
2. how do i use char/varchar when saving?&lt;/p&gt;

&lt;p&gt;I think this is just a problem of unspecific descriptions &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                    <comment id="17483" author="le_shatai" created="Wed, 22 Feb 2012 16:28:32 +0000"  >&lt;p&gt;Hi Benjamin&lt;/p&gt;

&lt;p&gt;Sorry, for this long delay.&lt;br/&gt;
I had a deeper inspection what happens when I persist data into a field of type varbinary(MAX) and I got this (using the SQL profiler):&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-sql&quot;&gt;declare @p1 int
set @p1=NULL
exec sp_prepexec @p1 output,
N&apos;@P1 nvarchar(36),@P2 nvarchar(max),@P3 nvarchar(34)&apos;,
N&apos;INSERT INTO mc_dokument_data (id, data, mc_dokument_id) VALUES (@P1, @P2, @P3)&apos;,
N&apos;03DDAAD1-4BFA-416B-A0C0-9B8B7148F31C&apos;,
N&apos;0x3c3f786d6c20766572736...&apos;,
N&apos;mwe3bc2c0da6543d1f48d7c83e64f5c449&apos;
&lt;span class=&quot;code-keyword&quot;&gt;select&lt;/span&gt; @p1
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;But it has to be ( removed &apos;-quotes and @P2 changed to varbinary(MAX) ):&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-sql&quot;&gt;declare @p1 int
set @p1=NULL
exec sp_prepexec @p1 output,
N&apos;@P1 nvarchar(36),@P2 varbinary(max),@P3 nvarchar(34)&apos;,
N&apos;INSERT INTO mc_dokument_data (id, data, mc_dokument_id) VALUES (@P1, @P2, @P3)&apos;,
N&apos;03DDAAD1-4BFA-416B-A0C0-9B8B7148F31C&apos;,
0x3c3f786d6c20766572736...,
N&apos;mwe3bc2c0da6543d1f48d7c83e64f5c449&apos;
&lt;span class=&quot;code-keyword&quot;&gt;select&lt;/span&gt; @p1
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I am not really sure any more if this is caused from Doctrine or from the &apos;MS SQL-Server PHP-PDO-Driver 2.0.1&apos; .&lt;br/&gt;
But I guess this comes from the driver.&lt;br/&gt;
If you can validate this, I will make a bug report to them.&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;funny&lt;/em&gt; thing is if I do this via &lt;em&gt;executeQuery&lt;/em&gt; it works...&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$data = unpack(&lt;span class=&quot;code-quote&quot;&gt;&quot;H*&quot;&lt;/span&gt; , __some__data__);
$data = &apos;0x&apos;.$data[1];

$em-&amp;gt;executeQuery(
    &lt;span class=&quot;code-quote&quot;&gt;&quot;INSERT INTO mc_dokument_data (id, mc_dokument_id, data)&quot;&lt;/span&gt;. 
   &lt;span class=&quot;code-quote&quot;&gt;&quot;VALUES(&apos;&quot;&lt;/span&gt;.$id.&lt;span class=&quot;code-quote&quot;&gt;&quot;&apos; , &apos;&quot;&lt;/span&gt; . $documentId . &lt;span class=&quot;code-quote&quot;&gt;&quot;&apos;, &quot;&lt;/span&gt; . $data . &lt;span class=&quot;code-quote&quot;&gt;&quot; )&quot;&lt;/span&gt;
);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;Hopefully I could clarify my problem.&lt;/p&gt;

&lt;p&gt;Regards&lt;br/&gt;
 Martin Weise&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>