<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Fri May 24 18:07:37 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://doctrine-project.org/jira/si/jira.issueviews:issue-xml/DBAL-398/DBAL-398.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Doctrine Project</title>
    <link>http://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-398] Native query does not allow mysql assignment operator :=</title>
                <link>http://doctrine-project.org/jira/browse/DBAL-398</link>
                <project id="10040" key="DBAL">Doctrine DBAL</project>
                        <description>&lt;p&gt;When trying to use the mysql assignment operator in a native query one gets an exception as SqlParserUtils does not qualify the character after the : as being part of a valid parameter value.&lt;/p&gt;

&lt;p&gt;Undefined index: in vendor/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtils.php line 156 (uncaught exception)&lt;/p&gt;


&lt;p&gt;A simple example is&lt;br/&gt;
$rsm = new ResultSetMapping();&lt;br/&gt;
$rsm-&amp;gt;addScalarResult(&apos;rank&apos;, &apos;rank&apos;);&lt;br/&gt;
$qry = $em-&amp;gt;createNativeQuery(&quot;&lt;br/&gt;
  SELECT (@rank := 1) AS rank&lt;br/&gt;
&quot;);&lt;br/&gt;
$result = $qry-&amp;gt;getResult(Query::HYDRATE_ARRAY);&lt;/p&gt;


&lt;p&gt;Or a more complicated example is (similar to actual use):&lt;/p&gt;

&lt;p&gt;$rsm = new ResultSetMapping();&lt;br/&gt;
$rsm-&amp;gt;addScalarResult(&apos;rank&apos;, &apos;rank&apos;);&lt;br/&gt;
$qry = $em-&amp;gt;createNativeQuery(&quot;&lt;br/&gt;
  SELECT rank FROM&lt;br/&gt;
    (SELECT (@rank := @rank +1) AS rank FROM (SELECT @rank :=0) rnk2) rnk1&lt;br/&gt;
&quot;);&lt;br/&gt;
$result = $qry-&amp;gt;getResult(Query::HYDRATE_ARRAY);&lt;/p&gt;


&lt;p&gt;I have attached quick-fix patch, but it looks like the getPlaceholderPositions method is wanting something better overall (due to the TODO comment in it).&lt;/p&gt;</description>
                <environment>Using Doctrine within Symfony 2.1.x</environment>
            <key id="14322">DBAL-398</key>
            <summary>Native query does not allow mysql assignment operator :=</summary>
                <type id="1" iconUrl="http://doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="5" iconUrl="http://doctrine-project.org/jira/images/icons/statuses/resolved.png">Resolved</status>
                    <resolution id="1">Fixed</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="dward">David Ward</reporter>
                        <labels>
                        <label>mysql</label>
                    </labels>
                <created>Tue, 18 Dec 2012 19:40:18 +0000</created>
                <updated>Thu, 3 Jan 2013 22:38:50 +0000</updated>
                    <resolved>Sat, 22 Dec 2012 13:24:23 +0000</resolved>
                            <version>2.3</version>
                                <fixVersion>2.3.2</fixVersion>
                                        <due></due>
                    <votes>0</votes>
                        <watches>2</watches>
                        <comments>
                    <comment id="19156" author="dward" created="Tue, 18 Dec 2012 20:38:25 +0000"  >&lt;p&gt;A pull request has been added at &lt;a href=&quot;https://github.com/doctrine/dbal/pull/237&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/dbal/pull/237&lt;/a&gt; which also has tests added.&lt;/p&gt;</comment>
                    <comment id="19213" author="brysonarmstrong" created="Thu, 3 Jan 2013 22:36:42 +0000"  >&lt;p&gt;I ran into this error and the fix caused other queries to have errors. &lt;/p&gt;

&lt;p&gt;I fixed it by changing line 57 in vendor/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtils.php:&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; 
&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($statement[$i] == $match &amp;amp;&amp;amp; !$inLiteral &amp;amp;&amp;amp; (!$isPositional &amp;amp;&amp;amp; $statement[$i+1] != &apos;=&apos;)) {
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; 

&lt;p&gt;to: &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;
&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($statement[$i] == $match &amp;amp;&amp;amp; !$inLiteral &amp;amp;&amp;amp; ($isPositional || $statement[$i+1] != &apos;=&apos;)) {
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt; </comment>
                </comments>
                    <attachments>
                    <attachment id="11365" name="FixNativeAssignmentOperator.patch" size="613" author="dward" created="Tue, 18 Dec 2012 19:40:18 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>