Doctrine 1
  1. Doctrine 1
  2. DC-340

Pager does not work with MS SQL Server

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Duplicate
    • Affects Version/s: 1.2.0
    • Fix Version/s: None
    • Component/s: Pager
    • Labels:
      None
    • Environment:
      Windows 2003 Server. IIS 6.0. MS SQL Server 2005. Symfony 1.4

      Description

      Hi,

      I can't use a pager. For example :
      $q = Doctrine_Query::create()>select( "*" )>from( "utilisateur" );

      $pager = new customDoctrinePager( $q, 1, 10 );
      $pager->init();

      $results = $pager->getResults();

      gives me :
      SQLSTATE[HY000]: General error: 10007 Invalid column name 'id'. [10007] (severity 5) [SELECT TOP 10 [inner_tbl].[id] AS [u__id] FROM (SELECT TOP 10 [u].[id] AS [u__id], [u].[utisateurnom] AS [u__utisateurnom] FROM [utilisateur] [u]) AS [inner_tbl]]. Failing Query: "SELECT TOP 10 [inner_tbl].[id] AS [u__id] FROM (SELECT TOP 10 [u].[id] AS [u__id], [u].[utisateurnom] AS [u__utisateurnom] FROM [utilisateur] [u]) AS [inner_tbl]"

      The query :
      SELECT
      TOP 10 [inner_tbl].[id] AS [u__id]
      FROM
      (
      SELECT
      TOP 10 [u].[id] AS [u__id], [u].[utisateurnom] AS [u__utisateurnom]
      FROM
      [utilisateur] [u]
      ) AS [inner_tbl]

      is wrong.

      This one would be correct :
      SELECT
      TOP 10 [inner_tbl].[u__id] AS [u__id]
      FROM
      (
      SELECT
      TOP 10 [u].[id] AS [u__id], [u].[utisateurnom] AS [u__utisateurnom]
      FROM
      [utilisateur] [u]
      ) AS [inner_tbl]

      This code works :
      $q = Doctrine_Query::create()
      ->select( '*' )
      ->from( 'utilisateur u' );
      $this->resultSet = $q->execute();

      This one gives the save error :
      $q = Doctrine_Query::create()
      ->select( '*' )
      ->from( 'utilisateur u' );

      $q->limit(10);
      $q->offset(1);
      $this->resultSet = $q->execute();

      This is very blocker for me.

      Nb. I am not sure of the Doctrine's version used by symfony 1.4

        Activity

        Hide
        lr added a comment -

        Same problem with
        $this->produit = Doctrine::getTable( "TProduit" )>find( $request>getParameter("produitId") );

        The inner query gives

        t__produit_id

        but the main query tries to select

        [inner_tbl].[produit_id]

        Show
        lr added a comment - Same problem with $this->produit = Doctrine::getTable( "TProduit" ) >find( $request >getParameter("produitId") ); The inner query gives t__produit_id but the main query tries to select [inner_tbl] . [produit_id]
        Hide
        Olivier Sieffert added a comment -

        Same problem when use the pager, since Doctrine 1.2.0rc2. My config: Linux Apache/PHP5.3, SQL Server 2000

        Show
        Olivier Sieffert added a comment - Same problem when use the pager, since Doctrine 1.2.0rc2. My config: Linux Apache/PHP5.3, SQL Server 2000
        Hide
        Michael Card added a comment - - edited

        Duplicate of DC-289. Should be closed as duplicate.

        Show
        Michael Card added a comment - - edited Duplicate of DC-289 . Should be closed as duplicate.
        Hide
        Guilherme Blanco added a comment -

        DC-289 refers to same issue and it's already committed. Everything should be working now.

        Show
        Guilherme Blanco added a comment - DC-289 refers to same issue and it's already committed. Everything should be working now.

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            lr
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: