Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any alternatives to GSP (General SQL Parser)?

General SQL Parser (GSP) is a quite feature rich SQL parser (to the extent that I have played with it) that allows for modifying SQL statements in a robust way by altering the parse tree itself. Furthermore, it supports SQL flavors for most popular databases. However, a big minus with GSP is that it is horribly, simply horribly, documented: the javadoc's consist mostly of the raw method and property names (with almost no comments), there are really no documentation that outlines the core functionality and the meaning of most important properties and methods; and it seems like they have just exposed everything as public members, making the API very hard to grasp by looking at it. The only documentation is a bunch of practical examples from which you have to reverse-engineer the meaning of the API calls yourself.

I do not like producing production critical software with a library like that. So due to the above, I would prefer using another parser, but have unfortunately failed to find any alternatives (for java) with similar functionality and support for multiple SQL flavors.

Are there any comparable (!) alternatives to GSP for java out there?

like image 427
someName Avatar asked Nov 11 '11 15:11

someName


People also ask

What is SQL parser?

The parsing stage involves separating the pieces of a SQL statement into a data structure that other routines can process. The database parses a statement when instructed by the application, which means that only the application, and not the database itself, can reduce the number of parses.

What is MySQL parser?

The MySQL server receives queries in the SQL format. Once a query is received, it first needs to be parsed, which involves translating it from what is essentially a textual format into a combination of internal binary structures that can be easily manipulated by the optimizer.

What does query parser do?

A Query Parser is a component responsible for parsing the textual query and convert it into corresponding Lucene Query objects.


2 Answers

I'm James from gudu software(company that developed General SQL Parser). Due to the complexity of SQL language of various databases such as Oracle, SQL Server, DB2, MySQL, Teradata, PostgreSQL, the SQL Parser we created to support those databases was a little bit complicated as well.

I have to admit that the document of General SQL Parser is really poor, Maybe we should put more effort on the document rather than SQL library itself.

Fortunately, we have created a rich set of demos to help people getting started quickly.

If are still interested in using General SQL Parser, please kindly let me know(I can be reached via [email protected]). We are happy to help.

like image 70
James Wang Avatar answered Sep 29 '22 22:09

James Wang


Have you had a look at JsqlParser? I don't know how it compares feature wise, but I've seen it used in production code and it works extremely well.

like image 35
laz Avatar answered Sep 29 '22 21:09

laz