M
M
Maxim2013-05-26 08:37:07
Java
Maxim, 2013-05-26 08:37:07

Sooo simple java SQL parser?

Interested in not a complete analysis, but a selective one. Those. you need to understand that this is, for example, a table creation operator and get the table name from it, everything else is of no interest, even if it is a deliberately incorrect expression like: “CREATE TABLE test_table;”, we get the value of “test_table” and stop. Or, for example, get the name of both tables in the forenkey creation statement.
It would also be great if these descriptions were stored in some kind of textual form, i.e. so that you can add a new object for parsing or change an existing one and still not rebuild anything.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Puma Thailand, 2013-05-26
@opium

Well, write regular expressions and get them with the help of them.
Well, regular expressions can be stored in a file without any problems.

K
KEKSOV, 2013-05-26
@KEKSOV

There is a discussion on the stack about a similar question.
The following options are offered JSqlParser , ZQL and another paid option . They also recommended using ANTLR - it seems that the StringTemplate functionality is suitable for your case

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question