Home » Database » SQL_Parser » Bug #4059
parseFieldList (or Options?) doesn't handle auto_increment
Details
| Submitted | 2005-04-05 04:07 UTC |
|---|---|
| From | epte at ruffdogs dot com |
| Status | Closed |
| Package | SQL_Parser |
| PHP Version | 4.3.8 |
| Roadmaps | (Not assigned) |
Comments
[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"
[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);