Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.7.0

Bug #8388 PATCH NEEDED - Between statements not recognized
Submitted: 2006-08-08 13:43 UTC
From: denis at denismayer dot com Assigned:
Status: Open Package: SQL_Parser (version CVS)
PHP Version: 5.1.4 OS: Windows
Roadmaps: 0.5.1    
Subscription  


 [2006-08-08 13:43 UTC] denis at denismayer dot com (Denis)
Description: ------------ The following sql statement is not recognized by the SQL Parser: SELECT AVG(CUSTOMER.AGE) FROM CUSTOMER WHERE CUSTOMER.AGE BETWEEN 21 AND 35 GROUP BY CUSTOMER.AGE The parser says that GROUP token is not an operator. I believe the parser is not recognizing the BETWEEN statement properly.

Comments

 [2006-08-25 07:36 UTC] home at saint dot vel dot pl (Chris)
I encountered the same problem and I think the problem is that between operator does not have special treatment in the SQL_Parser::parseSearchClause() function, i.e. and is interpreted as the begining of the next constraint in the where clause while it should be a part of the current expression. I think the solution is easy. When you add a short block of code in the previously mentioned function it is working fine. In switch(clause['op']) statement add new case block like that: case 'between': if ($this->isReserved()) { return $this->raiseError('Expected a value'); } $clause['arg_2']['value'] = $this->lexer->tokText; $clause['arg_2']['type'] = $this->token; //if next token is not and then raise error $this->getTok(); if ($this->token != 'and') { return $this->raiseError('Expected "and"'); } //get next token $this->getTok(); if ($this->isReserved()) { return $this->raiseError('Expected a value'); } $clause['arg_3']['value'] = $this->lexer->tokText; $clause['arg_3']['type'] = $this->token; break;
 [2007-06-28 11:13 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2011-02-14 10:13 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!