We are currently using JSqlParser to transform our sqls and found it extremely helpful! In doing so, we also found a few bugs. If you could incorporate some of those fixes into the next build, that would be great!
JSqlParser Bugs:
1. Column.java to return the column alias in toString
2. Update.java does not contain a toString method
3. ColumnDefinition.java - Remove unnecessary SUN API import, warning if compiled with Java 6.
4. DateValue.java missing toString method
5. InverseExpression.java missing toString method
6. getdate for SQL Server is missing () in toString
7. Table/Sub-select alias generates "AS" in toString which is not supported in Oracle
The grammar provided does not handle some of the following cases. We realize that some may be database specific, but if you can also include this in your next distribution, that would be much appreciated!
Grammar Improvements:
1. General Casting is not supported. (ex. cast(code as integer))
2. Concatenation/Addition within Case stmt does not parse (ex. select CASE a WHEN 1 THEN 1 ELSE b+c END)
3. Count distinct does not parse. (ex. SELECT Count(DISTINCT a.id) AS id)
4. Casting of a function in MSSQL does not parse. (ex.
select max( cast( substring(code, 3, LEN(code)) as bigint ) ) from a)
5. SQL Server grammar of "with (updlock)" does not parse. (ex. Select a from b with (updlock))
6. Oracle hints are removed after parsing (ex. select /*+rule*/ ….)
7. (+) for Oracle does not parse
8. Concatenation in Order By does not parse (ex. …. order by a.last_name + a.first_name)
9. Casting and Concatenation in Select does not parse (ex. select Cast(a.id AS VARCHAR) + ':' + Cast(b.id AS VARCHAR) AS
finalId ….)
10. Arithmetic within Cast does not parse (ex. cast(a.debit_amount-a.credit_amount as varchar))
11. Table with format Database.Schema.Table cannot be parsed
Other miscellaneous issues:
1. Use of enum keyword in CCJSqlParser.java - I believe if you compile with a newer version javaCC, this will go away.
Thanks!
Cynthia
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi there,
We are currently using JSqlParser to transform our sqls and found it extremely helpful! In doing so, we also found a few bugs. If you could incorporate some of those fixes into the next build, that would be great!
JSqlParser Bugs:
1. Column.java to return the column alias in toString
2. Update.java does not contain a toString method
3. ColumnDefinition.java - Remove unnecessary SUN API import, warning if compiled with Java 6.
4. DateValue.java missing toString method
5. InverseExpression.java missing toString method
6. getdate for SQL Server is missing () in toString
7. Table/Sub-select alias generates "AS" in toString which is not supported in Oracle
The grammar provided does not handle some of the following cases. We realize that some may be database specific, but if you can also include this in your next distribution, that would be much appreciated!
Grammar Improvements:
1. General Casting is not supported. (ex. cast(code as integer))
2. Concatenation/Addition within Case stmt does not parse (ex. select CASE a WHEN 1 THEN 1 ELSE b+c END)
3. Count distinct does not parse. (ex. SELECT Count(DISTINCT a.id) AS id)
4. Casting of a function in MSSQL does not parse. (ex.
select max( cast( substring(code, 3, LEN(code)) as bigint ) ) from a)
5. SQL Server grammar of "with (updlock)" does not parse. (ex. Select a from b with (updlock))
6. Oracle hints are removed after parsing (ex. select /*+rule*/ ….)
7. (+) for Oracle does not parse
8. Concatenation in Order By does not parse (ex. …. order by a.last_name + a.first_name)
9. Casting and Concatenation in Select does not parse (ex. select Cast(a.id AS VARCHAR) + ':' + Cast(b.id AS VARCHAR) AS
finalId ….)
10. Arithmetic within Cast does not parse (ex. cast(a.debit_amount-a.credit_amount as varchar))
11. Table with format Database.Schema.Table cannot be parsed
Other miscellaneous issues:
1. Use of enum keyword in CCJSqlParser.java - I believe if you compile with a newer version javaCC, this will go away.
Thanks!
Cynthia
I can't work on this project right now, but I would be glad to add you to the list of developers if you like!
Hi,
I am actually using this library to parse sql in one application so I could fix some bugs and resolved problems.
I'm using this under Java 5 and could also prepare source code to use generics etc. Maybe this would be done in another branch?
If you are interesed help please contact me.
Przemyslaw Chmielewski