Google Groups Home
Help | Sign in
#917: Offset Oracle and Hydrator
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 26 - Collapse all   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Doctrine  
View profile
 More options 26 Mar, 17:34
From: "Doctrine" <no-re...@phpdoctrine.org>
Date: Wed, 26 Mar 2008 17:34:36 -0000
Local: Wed 26 Mar 2008 17:34
Subject: [Doctrine] #917: Offset Oracle and Hydrator
#917: Offset Oracle and Hydrator
-------------------------+------------------------------------------------- -
 Reporter:  Garfield-fr  |       Owner:  jwage
     Type:  defect       |      Status:  new  
 Priority:  major        |   Milestone:  0.10.4
Component:  Attributes   |     Version:  0.10  
 Keywords:               |  
-------------------------+------------------------------------------------- -
 If i use the offset > 1 with Oracle, the query has a new parameter
 DCTRN_ROWNUM and the hydator don't work.

--
Ticket URL: <http://trac.phpdoctrine.org/ticket/917>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doctrine  
View profile
 More options 27 Mar, 08:00
From: "Doctrine" <no-re...@phpdoctrine.org>
Date: Thu, 27 Mar 2008 08:00:52 -0000
Local: Thurs 27 Mar 2008 08:00
Subject: Re: [Doctrine] #917: Offset Oracle and Hydrator
#917: Offset Oracle and Hydrator
--------------------------+------------------------------------------------ -
  Reporter:  Garfield-fr  |       Owner:  jwage
      Type:  defect       |      Status:  new  
  Priority:  major        |   Milestone:  0.10.4
 Component:  Attributes   |     Version:  0.10  
Resolution:               |    Keywords:        
--------------------------+------------------------------------------------ -
Comment (by Garfield-fr):

 Query example:
 {{{
 SELECT * FROM (SELECT a.*, ROWNUM dctrn_rownum FROM (SELECT u.user_id AS
 u__user_id, u.user_name AS u__user_name, u.first_name AS u__first_name,
 u.last_name AS u__last_name FROM users u ORDER BY u.user_name) a WHERE
 ROWNUM <= 40) WHERE dctrn_rownum >= 21
 }}}

--
Ticket URL: <http://trac.phpdoctrine.org/ticket/917#comment:1>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doctrine  
View profile
 More options 28 Mar, 19:15
From: "Doctrine" <no-re...@phpdoctrine.org>
Date: Fri, 28 Mar 2008 19:15:35 -0000
Local: Fri 28 Mar 2008 19:15
Subject: Re: [Doctrine] #917: Offset Oracle and Hydrator
#917: Offset Oracle and Hydrator
--------------------------+------------------------------------------------ -
  Reporter:  Garfield-fr  |       Owner:  jwage
      Type:  defect       |      Status:  new  
  Priority:  major        |   Milestone:  0.10.5
 Component:  Attributes   |     Version:  0.10  
Resolution:               |    Keywords:        
--------------------------+------------------------------------------------ -
Changes (by jwage):

  * milestone:  0.10.4 => 0.10.5

--
Ticket URL: <http://trac.phpdoctrine.org/ticket/917#comment:2>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doctrine  
View profile
 More options 4 Apr, 13:31
From: "Doctrine" <no-re...@phpdoctrine.org>
Date: Fri, 04 Apr 2008 12:31:41 -0000
Local: Fri 4 Apr 2008 13:31
Subject: Re: [Doctrine] #917: Offset Oracle and Hydrator
#917: Offset Oracle and Hydrator
--------------------------+------------------------------------------------ -
  Reporter:  Garfield-fr  |       Owner:  romanb
      Type:  defect       |      Status:  new  
  Priority:  major        |   Milestone:  0.10.5
 Component:  Attributes   |     Version:  0.10  
Resolution:               |    Keywords:        
--------------------------+------------------------------------------------ -
Changes (by romanb):

  * owner:  jwage => romanb

--
Ticket URL: <http://trac.phpdoctrine.org/ticket/917#comment:3>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doctrine  
View profile
 More options 9 Apr, 12:58
From: "Doctrine" <no-re...@phpdoctrine.org>
Date: Wed, 09 Apr 2008 11:58:34 -0000
Local: Wed 9 Apr 2008 12:58
Subject: Re: [Doctrine] #917: Offset Oracle and Hydrator
#917: Offset Oracle and Hydrator
--------------------------+------------------------------------------------ -
  Reporter:  Garfield-fr  |       Owner:  romanb
      Type:  defect       |      Status:  new  
  Priority:  major        |   Milestone:  0.10.5
 Component:  Attributes   |     Version:  0.10  
Resolution:               |    Keywords:        
--------------------------+------------------------------------------------ -
Comment (by bruno.p.reis):

 Since in oracle the rownum is mandatory, I did the following to solve
 this:
 (i think it would be better changing the Connection::modifyLimitQuery
 method, but this explains what is needed...)

 {{{
 class Doctrine_Connection_Oracle extends Doctrine_Connection
 {
     protected $pkNames;

 // ....

     public function setPkNames($pkNames) {
       $this->pkNames = $pkNames;
     }

 // ....

     public function modifyLimitQuery($query, $limit = false, $offset =
 false, $isManip = false)
     {
         $limit = (int) $limit;
         $offset = (int) $offset;
         if (preg_match('/^\s*SELECT/i', $query)) {
             if ( ! preg_match('/\sFROM\s/i', $query)) {
                 $query .= " FROM dual";
             }
             if ($limit > 0) {
                 // taken from
 http://svn.ez.no/svn/ezcomponents/packages/Database
                 $max = $offset + $limit;
                 ### Have distinct behavior for distinct querys (joins,
 etc...) and normal pagination...
                 $pk = $this->pkNames?
                       $this->quoteIdentifier($this->pkNames) :
                       '*';
                 if ($offset > 0) {
                     $min = $offset + 1;
                     $query = 'SELECT '.$pk.' FROM (SELECT a.*, ROWNUM
 dctrn_rownum FROM (' . $query
                            . ') a WHERE ROWNUM <= ' . $max . ') WHERE
 dctrn_rownum >= ' . $min;
                 } else {
                     $query = 'SELECT '.$pk.' FROM (' . $query .') a WHERE
 ROWNUM <= ' . $max;
                 }
             }
         }
         return $query;
     }
 }}}

 and...

 {{{
 class Doctrine_Query extends Doctrine_Query_Abstract implements Countable,
 Serializable
 {
 // .....
  public function getLimitSubquery()
     {
         $map    = reset($this->_queryComponents);
         $table  = $map['table'];
         $componentAlias = key($this->_queryComponents);
         // get short alias
         $alias      = $this->getTableAlias($componentAlias);
         // what about composite keys?
         $primaryKey = $alias . '.' .
 $table->getColumnName($table->getIdentifier());
         // initialize the base of the subquery
         $subquery   = 'SELECT DISTINCT ' .
 $this->_conn->quoteIdentifier($primaryKey);
         $driverName =
 $this->_conn->getAttribute(Doctrine::ATTR_DRIVER_NAME);

         #### added this so the oracle_connection knows what to look for in
 the select
         if ($driverName == 'oci') {
           if( count($this->_sqlParts['orderby']) > 0 ) {
             $subquery .= ','.implode(', ', $this->_sqlParts['orderby']);
           }
 $this->_conn->setPkNames($table->getColumnName($table->getIdentifier()));
         }
 }}}

 AND then I had to change the Hydrator because of the DCTRN_ROWNUM field
 when the select still as Select * from...
 {{{
     protected function _gatherRowData(&$data, &$cache, &$id,
 &$nonemptyComponents)
     {
         $rowData = array();

         foreach ($data as $key => $value) {
             // Parse each column name only once. Cache the results.
             if ( ! isset($cache[$key])) {
                 if($key=='DCTRN_ROWNUM') continue;
 }}}

--
Ticket URL: <http://trac.phpdoctrine.org/ticket/917#comment:4>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doctrine  
View profile
 More options 16 Apr, 12:14
From: "Doctrine" <no-re...@phpdoctrine.org>
Date: Wed, 16 Apr 2008 11:14:45 -0000
Local: Wed 16 Apr 2008 12:14
Subject: Re: [Doctrine] #917: Offset Oracle and Hydrator
#917: Offset Oracle and Hydrator
--------------------------+------------------------------------------------ -
  Reporter:  Garfield-fr  |       Owner:  romanb
      Type:  defect       |      Status:  new  
  Priority:  major        |   Milestone:  0.11.0
 Component:  Attributes   |     Version:  0.10  
Resolution:               |    Keywords:        
--------------------------+------------------------------------------------ -
Comment (by bruno.p.reis):

 This worked fine for most cases, but its not working for group by querys
 yet... IŽll see if I can figure something out.

--
Ticket URL: <http://trac.phpdoctrine.org/ticket/917#comment:5>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doctrine  
View profile
 More options 30 Apr, 20:34
From: "Doctrine" <no-re...@phpdoctrine.org>
Date: Wed, 30 Apr 2008 19:34:11 -0000
Local: Wed 30 Apr 2008 20:34
Subject: Re: [Doctrine] #917: Offset Oracle and Hydrator
#917: Offset Oracle and Hydrator
--------------------------+------------------------------------------------ -
  Reporter:  Garfield-fr  |       Owner:  romanb
      Type:  defect       |      Status:  new  
  Priority:  major        |   Milestone:  0.11.1
 Component:  Attributes   |     Version:  0.11  
Resolution:               |    Keywords:        
--------------------------+------------------------------------------------ -
Changes (by romanb):

  * version:  0.10 => 0.11
  * milestone:  0.11.0 => 0.11.1

--
Ticket URL: <http://trac.phpdoctrine.org/ticket/917#comment:6>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doctrine  
View profile
 More options 6 May, 09:03
From: "Doctrine" <no-re...@phpdoctrine.org>
Date: Tue, 06 May 2008 08:03:48 -0000
Local: Tues 6 May 2008 09:03
Subject: Re: [Doctrine] #917: Offset Oracle and Hydrator
#917: Offset Oracle and Hydrator
--------------------------+------------------------------------------------ -
  Reporter:  Garfield-fr  |       Owner:  romanb
      Type:  defect       |      Status:  new  
  Priority:  major        |   Milestone:  0.11.1
 Component:  Attributes   |     Version:  0.11  
Resolution:               |    Keywords:        
--------------------------+------------------------------------------------ -
Comment (by Garfield-fr):

 I have changed the method to check the field into the hydrator.

 Show into the patch v2

--
Ticket URL: <http://trac.phpdoctrine.org/ticket/917#comment:7>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doctrine  
View profile
 More options 10 May, 02:12
From: "Doctrine" <no-re...@phpdoctrine.org>
Date: Sat, 10 May 2008 01:12:55 -0000
Local: Sat 10 May 2008 02:12
Subject: Re: [Doctrine] #917: Offset Oracle and Hydrator
#917: Offset Oracle and Hydrator
--------------------------+------------------------------------------------ -
  Reporter:  Garfield-fr  |       Owner:  romanb
      Type:  defect       |      Status:  closed
  Priority:  major        |   Milestone:  0.11.1
 Component:  Attributes   |     Version:  0.11  
Resolution:  fixed        |    Keywords:        
--------------------------+------------------------------------------------ -
Changes (by jwage):

  * status:  new => closed
  * resolution:  => fixed

Comment:

 (In [4348]) fixes #917 - Fixes hydration issue

--
Ticket URL: <http://doctrine.pengus.net/cgi-bin/trac.cgi/ticket/917#comment:8>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doctrine  
View profile
 More options 10 May, 02:13
From: "Doctrine" <no-re...@phpdoctrine.org>
Date: Sat, 10 May 2008 01:13:12 -0000
Local: Sat 10 May 2008 02:13
Subject: Re: [Doctrine] #917: Offset Oracle and Hydrator
#917: Offset Oracle and Hydrator
--------------------------+------------------------------------------------ -
  Reporter:  Garfield-fr  |       Owner:  romanb
      Type:  defect       |      Status:  closed
  Priority:  major        |   Milestone:  0.11.0
 Component:  Attributes   |     Version:  0.11  
Resolution:  fixed        |    Keywords:        
--------------------------+------------------------------------------------ -
Changes (by jwage):

  * milestone:  0.11.1 => 0.11.0

--
Ticket URL: <http://trac.phpdoctrine.org/ticket/917#comment:9>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doctrine  
View profile
 More options 10 May, 10:07
From: "Doctrine" <no-re...@phpdoctrine.org>
Date: Sat, 10 May 2008 09:07:47 -0000
Local: Sat 10 May 2008 10:07
Subject: Re: [Doctrine] #917: Offset Oracle and Hydrator
#917: Offset Oracle and Hydrator
--------------------------+------------------------------------------------ -
  Reporter:  Garfield-fr  |       Owner:  romanb  
      Type:  defect       |      Status:  reopened
  Priority:  major        |   Milestone:  0.11.0  
 Component:  Attributes   |     Version:  0.11    
Resolution:               |    Keywords:          
--------------------------+------------------------------------------------ -
Changes (by romanb):

  * status:  closed => reopened
  * resolution:  fixed =>

Comment:

 I did not yet address this ticket for 2 reasons:

 1) The provided patch is very slow (numRows * numColumn) calls of explode
 + count
 2) If i understood bruno.p.reis correctly then there is more to it than
 just the field this hydration problem

 bruno.p.reis: do you have any new information? is it sufficient to address
 only the hydration problem? If so i will do that in a much more efficient
 way.

--
Ticket URL: <http://trac.phpdoctrine.org/ticket/917#comment:10>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Doctrine  
View profile
 More options 12 May, 12:17
From: "Doctrine" <no-re...@phpdoctrine.org>
Date: Mon, 12 May 2008 11:17:57 -0000
Local: Mon 12 May 2008 12:17
Subject: Re: [Doctrine] #917: Offset Oracle and Hydrator