JSQLParser / JSqlParser

JSqlParser parses an SQL statement and translate it into a hierarchy of Java classes. The generated hierarchy can be navigated using the Visitor Pattern
https://github.com/JSQLParser/JSqlParser/wiki
Apache License 2.0
5.43k stars 1.35k forks source link

`SET ...` statement not supported #1945

Closed shubhjet closed 7 months ago

shubhjet commented 10 months ago

I am using Informix and JSQParser to parse the SQL statements.:


set isolation to dirty read;
manticore-projects commented 7 months ago

Greetings.

With latest JSQLParser-4.10 Snapshot, you can parse your RDBMS specific statement like:

String sqlStr = "set isolation to dirty read;";
Statement statement = CCJSqlParserUtil.parse(
        sqlStr,
        parser -> parser.withUnsupportedStatements(true) );
Assertions.assertInstanceOf(UnsupportedStatement.class, statement);
TestUtils.assertStatementCanBeDeparsedAs(statement, sqlStr, true);

This should be good enough for anything, that is not a Query or a DML or a standard compliant DDL -- unless there was a very strong reason to access the details of the statement. I am going to close most RDBMS specific DDL issues in this regard.