<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Fri May 24 11:56:42 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/DDC-2193/DDC-2193.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>[DDC-2193] Named native query bug?</title>
                <link>http://doctrine-project.org/jira/browse/DDC-2193</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;@NamedNativeQueries is a useful thing, but I have found some problems during my using.&lt;br/&gt;
1&#12289;Normal&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;
 /**
 * @NamedNativeQueries({
 *      @NamedNativeQuery(
 *          name            = &lt;span class=&quot;code-quote&quot;&gt;&quot;fetchMultipleJoinsEntityResults&quot;&lt;/span&gt;,
 *          resultSetMapping= &lt;span class=&quot;code-quote&quot;&gt;&quot;mappingMultipleJoinsEntityResults&quot;&lt;/span&gt;,
 *          query            = &lt;span class=&quot;code-quote&quot;&gt;&quot;SELECT * FROM test &quot;&lt;/span&gt;
 *      )
 * })
 */
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;2&#12289;Error&#65292;cannot connect to the server&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;
 /**
 * @NamedNativeQueries({
 *      @NamedNativeQuery(
 *          name            = &lt;span class=&quot;code-quote&quot;&gt;&quot;fetchMultipleJoinsEntityResults&quot;&lt;/span&gt;,
 *          resultSetMapping= &lt;span class=&quot;code-quote&quot;&gt;&quot;mappingMultipleJoinsEntityResults&quot;&lt;/span&gt;,
 *          query            = &quot;SELECT * 
            FROM test &quot;
 *      )
 * })
 */
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;3&#12289;Cannot use alias.The same problem as the second one.&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;
.......
 query            = &lt;span class=&quot;code-quote&quot;&gt;&quot;SELECT a as test FROM test &quot;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
            <key id="14303">DDC-2193</key>
            <summary>Named native query bug?</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="10000" iconUrl="http://doctrine-project.org/jira/images/icons/statuses/needinfo.png">Awaiting Feedback</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="dingdangjyz">dingdangjyz</reporter>
                        <labels>
                    </labels>
                <created>Tue, 11 Dec 2012 01:43:00 +0000</created>
                <updated>Mon, 31 Dec 2012 04:02:50 +0000</updated>
                                                                            <due></due>
                    <votes>0</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="19125" author="fabio.bat.silva" created="Wed, 12 Dec 2012 13:56:30 +0000"  >&lt;p&gt;Hi&lt;/p&gt;

&lt;p&gt;Doctrine does not change the native query at all&lt;br/&gt;
The problem seems related with database connection.&lt;/p&gt;

&lt;p&gt;Could you provide more details please?&lt;/p&gt;

&lt;p&gt;Cheers&lt;/p&gt;</comment>
                    <comment id="19127" author="dingdangjyz" created="Thu, 13 Dec 2012 01:12:44 +0000"  >&lt;p&gt;Doctrine\Common\Lexer.php&lt;/p&gt;

&lt;p&gt;Hello, after checking&#65292; I found the problem should be here. As long as SQL wrap, or fill in alias, it will be error. It seems to be the preg_split problem?&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;
        $flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE;
        $matches = preg_split($regex, $input, -1, $flags);

        foreach ($matches as $match) {
            &lt;span class=&quot;code-comment&quot;&gt;// Must remain before &apos;value&apos; assignment since it can change content
&lt;/span&gt;            $type = $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;getType($match[0]);

            $&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;-&amp;gt;tokens[] = array(
                &apos;value&apos; =&amp;gt; $match[0],
                &apos;type&apos;  =&amp;gt; $type,
                &apos;position&apos; =&amp;gt; $match[1],
            );
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="19128" author="fabio.bat.silva" created="Thu, 13 Dec 2012 10:59:21 +0000"  >&lt;p&gt;Hi&lt;/p&gt;

&lt;p&gt;Could you try to add a failing test case please ?&lt;/p&gt;

&lt;p&gt;Cheers&lt;/p&gt;</comment>
                    <comment id="19133" author="dingdangjyz" created="Fri, 14 Dec 2012 02:06:21 +0000"  >&lt;p&gt;xp php5.3.8 Apache&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;
&amp;lt;?php

namespace Models\Entities;

/**
 * @Entity
 * @Table
 *
 * @NamedNativeQueries({
 *      @NamedNativeQuery(
 *          name             = &lt;span class=&quot;code-quote&quot;&gt;&quot;find-hotel-item&quot;&lt;/span&gt;,
 *          resultSetMapping = &lt;span class=&quot;code-quote&quot;&gt;&quot;mapping-find-item&quot;&lt;/span&gt;,
 *          query            = &quot;SELECT Top 1 VEI_SN AS SN 
            FROM tourmanager.dbo.VEndorInfo vi 
INNER JOIN tourmanager.dbo.VEndorInfo2 vi2 ON 
vi.VEI_SN = vi2.VEI2_VEI_SN LEFT OUTER JOIN tourmanager.dbo.HotelInfo hi 
ON hi.hotelid = vi2.VEI2_VEI_SN INNER JOIN tourmanager.dbo.HotelInfo2 
hi2 ON hi2.hotelid = vi2.VEI2_VEI_SN AND hi2.LGC = 1 &quot;
 *      )
 * })
 *
 * @SqlResultSetMappings({
 *      @SqlResultSetMapping(
 *          name    = &lt;span class=&quot;code-quote&quot;&gt;&quot;mapping-find-item&quot;&lt;/span&gt;,
 *          entities= {
 *              @EntityResult(
 *                  entityClass = &lt;span class=&quot;code-quote&quot;&gt;&quot;HTHotelItem&quot;&lt;/span&gt;,
 *                  fields = {
 *                      @FieldResult(name = &lt;span class=&quot;code-quote&quot;&gt;&quot;id&quot;&lt;/span&gt;,   column=&lt;span class=&quot;code-quote&quot;&gt;&quot;SN&quot;&lt;/span&gt;)
 *                  }
 *              )
 *          }
 *      )
 * })
 *
 */

class HTHotelItem{
    /** @Id @Column(type=&lt;span class=&quot;code-quote&quot;&gt;&quot;integer&quot;&lt;/span&gt;) @GeneratedValue */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $id;
        
    /** @name */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $name;
    
    /** @city */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $city;
    
    /** @url */
    &lt;span class=&quot;code-keyword&quot;&gt;protected&lt;/span&gt; $url;
    
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; function loadMetadata(\Doctrine\ORM\Mapping\ClassMetadataInfo $metadata){
        $metadata-&amp;gt;addNamedNativeQuery(array(
            &apos;name&apos;              =&amp;gt; &apos;find-hotel-item&apos;,
            &apos;query&apos;             =&amp;gt; &apos;SELECT h FROM HTHotelItem h&apos;,
            &apos;resultSetMapping&apos;  =&amp;gt; &apos;\\Models\\Entities\\HTHotelItem&apos;
        ));
    }
    
    function getId(){
        &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;id;
    }
    
    function getName(){
        &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;name;
    }
    
    function getCity(){
        &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;city;
    }
    
    function getUrl(){
        &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;url;
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                    <comment id="19134" author="dingdangjyz" created="Fri, 14 Dec 2012 07:59:21 +0000"  >&lt;p&gt;@NamedNativeQueries query  &lt;/p&gt;

&lt;p&gt;If we write the long SQL, it will be fault. NO error massage.&lt;br/&gt;
1251 charecter must be wrong.&lt;br/&gt;
I still insist it is the problem of preg_split in &lt;br/&gt;
Doctrine\Common\Lexer.php&lt;/p&gt;</comment>
                    <comment id="19152" author="fabio.bat.silva" created="Sun, 16 Dec 2012 20:50:10 +0000"  >&lt;p&gt;Can&apos;t reproduce,&lt;/p&gt;

&lt;p&gt;Could you try to change the attached test case and make it fail.&lt;/p&gt;


&lt;p&gt;Cheers&lt;/p&gt;</comment>
                    <comment id="19178" author="beberlei" created="Mon, 24 Dec 2012 09:22:16 +0000"  >&lt;p&gt;The Doctrine\Common\Lexer is never used in combination with native queries, only with the Annotation Parser, so i cannot be the preg_split that causes your SQL to be broken. Or do you get annotation errors?&lt;/p&gt;

&lt;p&gt;Also what database are you using? maybe its related to the DBAL sql parsing?&lt;/p&gt;</comment>
                    <comment id="19195" author="dingdangjyz" created="Mon, 31 Dec 2012 04:02:50 +0000"  >&lt;p&gt;I&apos;m sorry my English is too bad. &lt;/p&gt;

&lt;p&gt;I think it&apos;s Doctrine \ is \ Lexer. PHP preg_split the function of the problem in this file.&lt;br/&gt;
My system environment is xp/apache 5.3 + / php_pdo_sqlsrv_53 / mssql2000&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="11363" name="DDC2193Test.php" size="2501" author="fabio.bat.silva" created="Sun, 16 Dec 2012 20:48:10 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>