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

Bug #4059 parseFieldList (or Options?) doesn't handle auto_increment
Submitted: 2005-04-05 04:07 UTC
From: epte at ruffdogs dot com Assigned:
Status: Closed Package: SQL_Parser
PHP Version: 4.3.8 OS:
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 48 - 19 = ?

 
 [2005-04-05 04:07 UTC] epte at ruffdogs dot com
Description: ------------ Summary says it. Reproduce code: --------------- $sql = " CREATE TABLE schedules ( id int(11) NOT NULL auto_increment, target_id int(11) NOT NULL default '0', PRIMARY KEY (id) ) TYPE=MyISAM;"; $_SQLParser = new SQL_Parser(NULL, 'MySQL'); $parseRes = $_SQLParser->parse($sql); Actual result: -------------- Parse error: Unexpected token auto_increment on line 13 id int(11) NOT NULL auto_increment, ^ found: "auto_increment"

Comments

 [2005-04-05 16:31 UTC] epte at ruffdogs dot com
Here's the patch: Index: Parser.php =================================================================== --- Parser.php (revision 2679) +++ Parser.php (working copy) @@ -337,6 +337,10 @@ case 'null': $haveValue = false; break; + case 'auto_increment': + $constraintOpts = array('type'=>'auto_increment', + 'value'=>true); + break; default: return $this->raiseError('Unexpected token ' .$this->lexer->tokText);
 [2005-04-06 04:59 UTC] busterb
Now, we're getting into dialect-specific stuff. I applied the patch, but is there a good way to get this into Dialect_MySQL instead? There has to be a generalized way to put hooks into the various parse functions.