#1696: queries with subqueries and limit() broken in 1.1
------------------------------+---------------------------------------------
  Reporter:  jasoneisen       |       Owner:  romanb               
      Type:  defect           |      Status:  new                  
  Priority:  major            |   Milestone:  1.1.0                
 Component:  Query/Hydration  |     Version:  1.1-DEV              
Resolution:                   |    Keywords:                       
  Has_test:  0                |    Mystatus:  Pending Core Response
 Has_patch:  0                |  
------------------------------+---------------------------------------------
Old description:

> Jasone: guilhermeblanco:
> [09:15am] guilhermeblanco: pong
> [09:20am] Jasone: found it
> [09:20am] Jasone: http://pastie.org/324011
> [09:21am] Jasone: it cant be tested because it is a mysql driver
> [09:22am] Jasone: just do any query with a subquery
> [09:22am] Jasone: an addWhere
> [09:22am] Jasone: and a limit()
> [09:22am] Jasone: and it should break
> [09:22am] Jasone: in 1.1
> [09:25am] Jasone: guilhermeblanco:
> [09:25am] Jasone: and something you did in r5014 breaks it
> [09:25am] Jasone: because it works in 5013
> [09:26am] guilhermeblanco: hm
> [09:26am] Jasone: now, $params is always empty
> [09:27am] Jasone: so it never runs a prepared statement
> [09:27am] guilhermeblanco: by changing from $params to
> $this->_params['where'] solves it?
> [09:28am] guilhermeblanco: I don't think it'll work out of the box... but
> I'll wait your answer, Jasone
> [09:28am] Jasone: it works for me
> [09:29am] Jasone: i figure you'll have a better idea
> [09:29am] Jasone: since you wrote 5014
> [09:29am] Jasone: and know what all the $_params entails
> [09:31am] guilhermeblanco: the point is you'll have to inflate the
> _params[where] anyway
> [09:32am] guilhermeblanco: since it may be this:
> [09:32am] Jasone: inflate?
> [09:32am] guilhermeblanco: array('foo', array('bar', 'baz'))
> [09:32am] guilhermeblanco: it'll need to be converted to:
> [09:32am] guilhermeblanco: array('foo', 'bar', 'baz')
> [09:32am] guilhermeblanco: since PDO does not accept foo.id IN ?
> [09:33am] guilhermeblanco: you'll have to convert the array of items into
> a list of ?, ?
> [09:33am] guilhermeblanco: so... when you inflate...
> [09:33am] guilhermeblanco: you'll have to:
> [09:33am] guilhermeblanco: foo.id IN (?, ?)
> [09:33am] guilhermeblanco: and remove the inner array
> [09:33am] guilhermeblanco: that's the point
> [09:33am] guilhermeblanco: you get it now?
> [09:33am] Jasone: yes
> [09:34am] Jasone: is there just a method i can pass it to that will do
> that
> [09:34am] guilhermeblanco: that's why raw _params['where'] will not work
> [09:34am] guilhermeblanco: there is... but you'll have to be sure the
> subquery does not have the IN ?
> [09:34am] guilhermeblanco: because they'll need to be converted
> guilhermeblanco: $this->fixArrayParameterValues\
> [09:36am] guilhermeblanco: it's this method, btw
> [09:38am] Jasone: but $params is still empty
> [09:38am] guilhermeblanco: hm... there's a getInternalParams method that
> maybe it's something like:
> [09:38am] guilhermeblanco: $this->getInternalParams('where')
> [09:39am] Jasone: well what im saying is
> [09:39am] Jasone: before, $params was populated

New description:

 Jasone: guilhermeblanco:

 [09:15am] guilhermeblanco: pong

 [09:20am] Jasone: found it

 [09:20am] Jasone: http://pastie.org/324011

 [09:21am] Jasone: it cant be tested because it is a mysql driver

 [09:22am] Jasone: just do any query with a subquery

 [09:22am] Jasone: an addWhere

 [09:22am] Jasone: and a limit()

 [09:22am] Jasone: and it should break

 [09:22am] Jasone: in 1.1

 [09:25am] Jasone: guilhermeblanco:

 [09:25am] Jasone: and something you did in r5014 breaks it

 [09:25am] Jasone: because it works in 5013

 [09:26am] guilhermeblanco: hm

 [09:26am] Jasone: now, $params is always empty

 [09:27am] Jasone: so it never runs a prepared statement

 [09:27am] guilhermeblanco: by changing from $params to
 $this->_params['where'] solves it?

 [09:28am] guilhermeblanco: I don't think it'll work out of the box... but
 I'll wait your answer, Jasone

 [09:28am] Jasone: it works for me

 [09:29am] Jasone: i figure you'll have a better idea

 [09:29am] Jasone: since you wrote 5014

 [09:29am] Jasone: and know what all the $_params entails

 [09:31am] guilhermeblanco: the point is you'll have to inflate the
 _params[where] anyway

 [09:32am] guilhermeblanco: since it may be this:

 [09:32am] Jasone: inflate?

 [09:32am] guilhermeblanco: array('foo', array('bar', 'baz'))

 [09:32am] guilhermeblanco: it'll need to be converted to:

 [09:32am] guilhermeblanco: array('foo', 'bar', 'baz')

 [09:32am] guilhermeblanco: since PDO does not accept foo.id IN ?

 [09:33am] guilhermeblanco: you'll have to convert the array of items into
 a list of ?, ?

 [09:33am] guilhermeblanco: so... when you inflate...

 [09:33am] guilhermeblanco: you'll have to:

 [09:33am] guilhermeblanco: foo.id IN (?, ?)

 [09:33am] guilhermeblanco: and remove the inner array

 [09:33am] guilhermeblanco: that's the point

 [09:33am] guilhermeblanco: you get it now?

 [09:33am] Jasone: yes

 [09:34am] Jasone: is there just a method i can pass it to that will do
 that

 [09:34am] guilhermeblanco: that's why raw _params['where'] will not work

 [09:34am] guilhermeblanco: there is... but you'll have to be sure the
 subquery does not have the IN ?

 [09:34am] guilhermeblanco: because they'll need to be converted

 guilhermeblanco: $this->fixArrayParameterValues\

 [09:36am] guilhermeblanco: it's this method, btw

 [09:38am] Jasone: but $params is still empty

 [09:38am] guilhermeblanco: hm... there's a getInternalParams method that
 maybe it's something like:

 [09:38am] guilhermeblanco: $this->getInternalParams('where')

 [09:39am] Jasone: well what im saying is

 [09:39am] Jasone: before, $params was populated

-- 
Ticket URL: <http://trac.doctrine-project.org/ticket/1696#comment:1>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"doctrine-svn" group.
 To post to this group, send email to [email protected]
 To unsubscribe from this group, send email to [EMAIL PROTECTED]
 For more options, visit this group at 
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---

Reply via email to