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

support for CREATE INDEX requested #131

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. define "create index i1 on t1 (c1)"
2. subsequent parse and create will result in 
"Warning: Invalid argument supplied for foreach() in 
D:\ontwikkeling\www\SqlParser\src\builders\SubTreeBuilder.php on line 109" 

Original issue reported on code.google.com by Henk.Blo...@gmail.com on 3 Mar 2014 at 11:20

GoogleCodeExporter commented 9 years ago
Currently CREATE INDEX is not part of the parser, so the Creator class will 
produce non-sense.

Original comment by pho...@gmx.de on 3 Mar 2014 at 3:50

GoogleCodeExporter commented 9 years ago
See r1144, there is a test case for the issue, it seems to work.

Original comment by pho...@gmx.de on 4 Mar 2014 at 11:46

GoogleCodeExporter commented 9 years ago
I have added some code to handle CREATE INDEX within the Creator class, see 
r1148. I'm not sure, what the second "..." means in the MySQL User Guide:

CREATE [UNIQUE|FULLTEXT|SPATIAL] INDEX index_name
    [index_type]
    ON tbl_name (index_col_name, ...)
    [index_option] 
    [algorithm_option | lock_option] ...

So it could be, that there are errors within the parser, please check that with 
your examples.

Original comment by pho...@gmx.de on 4 Mar 2014 at 1:07

GoogleCodeExporter commented 9 years ago
Ls,
As for now, I've only seen simple "CREATE INDEX" statements,
and they run fine now.
Thanks!
Henk

Original comment by Henk.Blo...@gmail.com on 5 Mar 2014 at 10:28

GoogleCodeExporter commented 9 years ago
Ok, I close the issue.

Original comment by pho...@gmx.de on 5 Mar 2014 at 10:39