A Parser for MySQL's SQL.
- Use JSqlParser for further dev.
- My fork of JSqlParser (support mysql, sid)
- Origin wumpz/JSqlParser
- Origin ultimoamore in Sourceforge.net
- Add # comment
- Partly supported(Need more test!)
- select
- insert
- update
- delete
- TableNames Finder not supported by JSqlParser(#issue6)
- SET
- SHOW
- COMMIT
- Delete table1, table2 ...
- Keywords
- EXTRACT
- ON DUPLICATE
Take Select as example
SELECT * FROM TableName; # comment by ent-worm
- Type: select
- Tables name used: TableName
- JAVACC, parse statements from top to bottom.
- tr & sed for clean origin query file
./clean.sh input [output]
String sql_statement = "select * from table1";
SimpleQuery q = new SimpleQuery(sql_statement);
String type = q.getType();
List<String> tables = q.getTables();