PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » SQL_Parser » Bug #4059

parseFieldList (or Options?) doesn't handle auto_increment

Details

Submitted2005-04-05 04:07 UTC
Fromepte at ruffdogs dot com
StatusClosed
PackageSQL_Parser
PHP Version4.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);