benpjohnson / php-sql-parser

Automatically exported from code.google.com/p/php-sql-parser
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

KEY clause in CREATE TABLE causes fatal error #123

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. define SQL statement "CREATE TABLE t1 (c1 CHAR(3),c2 CHAR(3),KEY(c1))"

2. subsequent parse and create on this statement will produce

3. Fatal error: Uncaught exception 'UnableToCreateSQLException' with message 
'unknown [expr_type] = index in "CREATE TABLE create-def expression subtree" 
[2] ' in 
D:\ontwikkeling\www\SqlParser\src\builders\TableBracketExpressionBuilder.php on 
line 101

What is the expected output? What do you see instead?
expected output is "CREATE TABLE t1 (c1 CHAR(3),c2 CHAR(3),KEY(c1))"

What version of the product are you using? On what operating system?
I checked out the version after r1080.
OS : Windows XP

Please provide any additional information below.
When you leave out "DEFAULT 10", it will run as expected.

Original issue reported on code.google.com by Henk.Blo...@gmail.com on 19 Feb 2014 at 12:49

GoogleCodeExporter commented 9 years ago
Oeps, sorry.
Last line must be 'When you leave out ",KEY(c1)", it will run as expected.'
Regards,
Henk

Original comment by Henk.Blo...@gmail.com on 19 Feb 2014 at 12:53

GoogleCodeExporter commented 9 years ago
See r1084, I have added a builder, which handles the INDEX or KEY within the 
CREATE TABLE statement.

Original comment by pho...@gmx.de on 21 Feb 2014 at 8:46