Uploaded image for project: 'Doctrine 1'
  1. Doctrine 1
  2. DC-254

getLimitSubquery Not Including All Order By Parts

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.0-BETA3
    • Fix Version/s: 1.2.0-RC1
    • Component/s: Query
    • Labels:
      None

      Description

      The getLimitSubquery function is only including the first orderby field and ignoring all remaining parts. The function also needs to be changed to include mssql and odbc.

      The diff's below provide corrections.

      Thanks,

      Mike

      diff -r Doctrine-1.1.2\lib\Doctrine\Query.php Doctrine-1.1.2-Fixes\lib\Doctrine\Query.php
      1367c1367
      <         if ($driverName == 'pgsql' || $driverName == 'oracle' || $driverName == 'oci') {
      ---
      >         if ($driverName == 'pgsql' || $driverName == 'oracle' || $driverName == 'oci' || $driverName == 'mssql' || $driverName == 'odbc') {
      1371,1387c1371,1392
      <                 $part_original = trim($e[0]);
      <                 $callback = create_function('$e', 'return trim($e, \'[]`"\');');
      <                 $part = trim(implode('.', array_map($callback, explode('.', $part_original))));
      < 
      <                 if (strpos($part, '.') === false) {
      <                     continue;
      <                 }
      < 
      <                 // don't add functions
      <                 if (strpos($part, '(') !== false) {
      <                     continue;
      <                 }
      < 
      <                 // don't add primarykey column (its already in the select clause)
      <                 if ($part !== $primaryKey) {
      <                     $subquery .= ', ' . $part_original;
      <                 }
      ---
      > 
      >                 foreach ($e as $f) {
      >                     if ($f == 0 || $f % 2 == 0) {
      >                         $part_original = trim($f);
      >                         $callback = create_function('$e', 'return trim($e, \'[]`"\');');
      >                         $part = trim(implode('.', array_map($callback, explode('.', $part_original))));
      > 
      >                         if (strpos($part, '.') === false) {
      >                             continue;
      >                         }
      > 
      >                         // don't add functions
      >                         if (strpos($part, '(') !== false) {
      >                             continue;
      >                         }
      > 
      >                         // don't add primarykey column (its already in the select clause)
      >                         if ($part !== $primaryKey) {
      >                             $subquery .= ', ' . $part_original;
      >                         }
      >                     }
      >                 }
      
      

        Activity

        gensisns Michael Card created issue -
        jwage Jonathan H. Wage made changes -
        Field Original Value New Value
        Description The getLimitSubquery function is only including the first orderby field and ignoring all remaining parts. The function also needs to be changed to include mssql and odbc.

        The diff's below provide corrections.

        Thanks,
        Mike

        diff -r Doctrine-1.1.2\lib\Doctrine\Query.php Doctrine-1.1.2-Fixes\lib\Doctrine\Query.php
        1367c1367
        < if ($driverName == 'pgsql' || $driverName == 'oracle' || $driverName == 'oci') {
        ---
        > if ($driverName == 'pgsql' || $driverName == 'oracle' || $driverName == 'oci' || $driverName == 'mssql' || $driverName == 'odbc') {
        1371,1387c1371,1392
        < $part_original = trim($e[0]);
        < $callback = create_function('$e', 'return trim($e, \'[]`"\');');
        < $part = trim(implode('.', array_map($callback, explode('.', $part_original))));
        <
        < if (strpos($part, '.') === false) {
        < continue;
        < }
        <
        < // don't add functions
        < if (strpos($part, '(') !== false) {
        < continue;
        < }
        <
        < // don't add primarykey column (its already in the select clause)
        < if ($part !== $primaryKey) {
        < $subquery .= ', ' . $part_original;
        < }
        ---
        >
        > foreach ($e as $f) {
        > if ($f == 0 || $f % 2 == 0) {
        > $part_original = trim($f);
        > $callback = create_function('$e', 'return trim($e, \'[]`"\');');
        > $part = trim(implode('.', array_map($callback, explode('.', $part_original))));
        >
        > if (strpos($part, '.') === false) {
        > continue;
        > }
        >
        > // don't add functions
        > if (strpos($part, '(') !== false) {
        > continue;
        > }
        >
        > // don't add primarykey column (its already in the select clause)
        > if ($part !== $primaryKey) {
        > $subquery .= ', ' . $part_original;
        > }
        > }
        > }
        The getLimitSubquery function is only including the first orderby field and ignoring all remaining parts. The function also needs to be changed to include mssql and odbc.

        The diff's below provide corrections.

        Thanks,

        Mike

        {code}
        diff -r Doctrine-1.1.2\lib\Doctrine\Query.php Doctrine-1.1.2-Fixes\lib\Doctrine\Query.php
        1367c1367
        < if ($driverName == 'pgsql' || $driverName == 'oracle' || $driverName == 'oci') {
        ---
        > if ($driverName == 'pgsql' || $driverName == 'oracle' || $driverName == 'oci' || $driverName == 'mssql' || $driverName == 'odbc') {
        1371,1387c1371,1392
        < $part_original = trim($e[0]);
        < $callback = create_function('$e', 'return trim($e, \'[]`"\');');
        < $part = trim(implode('.', array_map($callback, explode('.', $part_original))));
        <
        < if (strpos($part, '.') === false) {
        < continue;
        < }
        <
        < // don't add functions
        < if (strpos($part, '(') !== false) {
        < continue;
        < }
        <
        < // don't add primarykey column (its already in the select clause)
        < if ($part !== $primaryKey) {
        < $subquery .= ', ' . $part_original;
        < }
        ---
        >
        > foreach ($e as $f) {
        > if ($f == 0 || $f % 2 == 0) {
        > $part_original = trim($f);
        > $callback = create_function('$e', 'return trim($e, \'[]`"\');');
        > $part = trim(implode('.', array_map($callback, explode('.', $part_original))));
        >
        > if (strpos($part, '.') === false) {
        > continue;
        > }
        >
        > // don't add functions
        > if (strpos($part, '(') !== false) {
        > continue;
        > }
        >
        > // don't add primarykey column (its already in the select clause)
        > if ($part !== $primaryKey) {
        > $subquery .= ', ' . $part_original;
        > }
        > }
        > }

        {code}
        jwage Jonathan H. Wage made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 1.2.0-RC1 [ 10041 ]
        Resolution Fixed [ 1 ]
        Hide
        gensisns Michael Card added a comment -

        Additonal fix for this issue, was missing dblib originally.

        Mike

        diff -r Doctrine-1.1.2\lib\Doctrine\Query.php Doctrine-1.1.2-Fixes\lib\Doctrine\Query.php
        1367c1367
        < if ($driverName == 'pgsql' || $driverName == 'oracle' || $driverName == 'oci' || $driverName == 'mssql' || $driverName == 'odbc') {
        —
        > if ($driverName == 'pgsql' || $driverName == 'oracle' || $driverName == 'oci' || $driverName == 'mssql' || $driverName == 'odbc' || $driverName == 'dblib') {
        
        
        Show
        gensisns Michael Card added a comment - Additonal fix for this issue, was missing dblib originally. Mike diff -r Doctrine-1.1.2\lib\Doctrine\Query.php Doctrine-1.1.2-Fixes\lib\Doctrine\Query.php 1367c1367 < if ($driverName == 'pgsql' || $driverName == 'oracle' || $driverName == 'oci' || $driverName == 'mssql' || $driverName == 'odbc') { — > if ($driverName == 'pgsql' || $driverName == 'oracle' || $driverName == 'oci' || $driverName == 'mssql' || $driverName == 'odbc' || $driverName == 'dblib') {
        gensisns Michael Card made changes -
        Resolution Fixed [ 1 ]
        Status Closed [ 6 ] Reopened [ 4 ]
        Hide
        andrej.pavlovic Andrej Pavlovic added a comment -

        Come on guys, please include this fix into 1.2.4...

        Show
        andrej.pavlovic Andrej Pavlovic added a comment - Come on guys, please include this fix into 1.2.4...

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={expand=changesets[0:20].revisions[0:29],reviews, query=DC-254}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            guilhermeblanco Guilherme Blanco
            Reporter:
            gensisns Michael Card
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: