<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Sat May 25 12:12:38 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/DC-978/DC-978.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>[DC-978] Doctrine_Connection_Mssql dies on modifyLimitSubquery every time</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-978</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Looking at the latest version of Doctrine_Connection_Mssql in git repo:&lt;br/&gt;
&lt;a href=&quot;https://github.com/doctrine/doctrine1/blob/b4dc8e66a89a7e17cd195c489b18005e19ca9ea5/lib/Doctrine/Connection/Mssql.php&quot; class=&quot;external-link&quot;&gt;https://github.com/doctrine/doctrine1/blob/b4dc8e66a89a7e17cd195c489b18005e19ca9ea5/lib/Doctrine/Connection/Mssql.php&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In Doctrine_Query:getLimitSubquery() there is a call to Doctrine_Connection_Mssql::modifyLimitSubquery().&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;public&lt;/span&gt; function modifyLimitSubquery(Doctrine_Table $rootTable, $query, $limit = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, $offset = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, $isManip = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;)
{
	&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;modifyLimitQuery($query, $limit, $offset, $isManip, &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;);
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This in turn calls Doctrine_Connection_Mssql::modifyLimitQuery() wihtout passing the $queryOrigin parameter:&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;public&lt;/span&gt; function modifyLimitQuery($query, $limit = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, $offset = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, $isManip = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, $isSubQuery = &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;, Doctrine_Query $queryOrigin = &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;)
    {
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($limit === &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt; || !($limit &amp;gt; 0)) {
            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; $query;
        }

        $orderby = stristr($query, &apos;ORDER BY&apos;);

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($offset !== &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt; &amp;amp;&amp;amp; $orderby === &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;) {
            &lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Doctrine_Connection_Exception(&lt;span class=&quot;code-quote&quot;&gt;&quot;OFFSET cannot be used in MSSQL without ORDER BY due to emulation reasons.&quot;&lt;/span&gt;);
        }
        
        $count = intval($limit);
        $offset = intval($offset);

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($offset &amp;lt; 0) {
            &lt;span class=&quot;code-keyword&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; Doctrine_Connection_Exception(&lt;span class=&quot;code-quote&quot;&gt;&quot;LIMIT argument offset=$offset is not valid&quot;&lt;/span&gt;);
        }

        $orderbySql = $queryOrigin-&amp;gt;getSqlQueryPart(&apos;orderby&apos;);
        $orderbyDql = $queryOrigin-&amp;gt;getDqlPart(&apos;orderby&apos;);

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ($orderby !== &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;) {
            $orders = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;parseOrderBy(implode(&apos;, &apos;, $queryOrigin-&amp;gt;getDqlPart(&apos;orderby&apos;)));

            &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; ($i = 0; $i &amp;lt; count($orders); $i++) {
...
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;From just looking at the above code, the query chokes on the first call to a $queryOrigin method. It seems like there is a lot of missing code here which should work with the $query directly when $queryOrigin is not available...&lt;/p&gt;

&lt;p&gt;What is the point of $orderbySql and $orderbyDql variables when they are not used anywhere?&lt;/p&gt;

&lt;p&gt;This code looks like it&apos;s half way done and untested.&lt;/p&gt;</description>
                <environment>windows</environment>
            <key id="12434">DC-978</key>
            <summary>Doctrine_Connection_Mssql dies on modifyLimitSubquery every time</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/critical.png">Critical</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="jwage">Jonathan H. Wage</assignee>
                                <reporter username="andrej.pavlovic">Andrej Pavlovic</reporter>
                        <labels>
                    </labels>
                <created>Sun, 27 Feb 2011 17:14:51 +0000</created>
                <updated>Sun, 27 Feb 2011 17:17:16 +0000</updated>
                                    <version>1.2.4</version>
                                                <component>Connection</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>