Hi list.
Firstly, the bad news. My text editor crashed while I was working on my new SQL parser, very badly. Totally trashed the file. However, I managed to recover nearly the entire file from the coredump. And the part that I didn't get back I was busy rewriting anyway. I'm gonna learn vi instead of using nano from now on.
Now the good news: The parser is almost 100% ready to roll now. TODO: * detect basic errors in query * make sure other query types are all formatted quickly - verified working: SELECT, INSERT, DELETE, CREATE, DROP - todo: ALTER, UPDATE, ? * integrate with main PMA source * optimize more! (is profiling possible in PHP ?) * PHP3 compatibility ?
URL: http://games.techbc.ca/~robbat2/sqlparse.php
Notes: I have completely redone data.php from the MySQL lex.h in the source code, along with some modifications. This code hits some servers heavily for resources, I'm not sure why yet. (This is why it needs the optimizations). I still want a few more testcases to try out: 1. insert/select queries with nested calls to functions 2. update and alter queries
Known Bugs: If you have a table/field name that is a function name, and it is not escaped using the backticks, then the formatting WILL be wrong. There is no workaround for this. MySQL will reject the query anyway, so I think we should just document this.
If I get thru these issues this week, then I will see about getting the code into the CVS tree by next weekend.