#1440: Can't use placeholders if ->limit() is used in the query
-------------------------------------+--------------------------------------
 Reporter:  P.Vogelaar               |       Owner:  romanb
     Type:  defect                   |      Status:  new   
 Priority:  minor                    |   Milestone:        
Component:  Query/Hydration          |     Version:  1.0   
 Keywords:  limit placeholder where  |    Has_test:  0     
 Mystatus:  Pending Core Response    |   Has_patch:  0     
-------------------------------------+--------------------------------------
 I use the sfDoctrine plugin with symfony 1.1. The doctrine version is
 1.0-rc2.

 The following works:

 {{{

 $root =
 Doctrine::getTable('Question')->getTree()->findRoot($root_question_id);
         $query = Doctrine_Query::create()
                ->select('
                    q.name,
                    a.name,
                   )
                ->from('Question q')
                ->leftJoin("q.Answer a")
                ->leftJoin("q.QuestionGroup qg")
                ->leftJoin("q.Result r")
                ->where('q.level > 0')
                ->orderBy('qg.weight ASC, qg.name ASC')
                ->offset($pager['offset'])
                ->limit($pager['limit'])
                ;
 }}}

 But if I add this:

 {{{
  $query->addWhere('r.anonymous_user_id = ?', 'test');
 }}}

 I get:

 {{{
 SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error
 in your SQL syntax; check the manual that corresponds to your MySQL server
 version for the right syntax to use near '? ORDER BY q5.weight ASC,
 q5.name ASC LIMIT 3' at line 1
 }}}

 As soon as I comment "->limit($pager['limit'])", the query works again.

-- 
Ticket URL: <http://trac.phpdoctrine.org/ticket/1440>
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