How to use
#1341
Replies: 2 comments 2 replies
-
Please refer to String sql = "SELECT * FROM tab1, tab2 WHERE tab1.id (+) = tab2.ref";
Statement stmt = CCJSqlParserUtil.parse(sql);
StatementValidator validator = new StatementValidator();
validator.setContext(new ValidationContext()
.setCapabilities(Arrays.asList(DatabaseType.SQLSERVER, DatabaseType.POSTGRESQL)));
stmt.accept(validator);
Map<ValidationCapability, Set<ValidationException>> unsupportedErrors = validator
.getValidationErrors(DatabaseType.SQLSERVER);
assertErrorsSize(unsupportedErrors, 1);
assertNotSupported(unsupportedErrors.get(DatabaseType.SQLSERVER), Feature.oracleOldJoinSyntax);
unsupportedErrors = validator.getValidationErrors(DatabaseType.POSTGRESQL);
assertErrorsSize(unsupportedErrors, 1);
assertNotSupported(unsupportedErrors.get(DatabaseType.POSTGRESQL), Feature.oracleOldJoinSyntax); |
Beta Was this translation helpful? Give feedback.
2 replies
-
As well you could look into: https://github.com/JSQLParser/JSqlParser/wiki/Examples-of-SQL-Validation. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi All,
I I just want a sql validator not the optimizer and all?
How can I get just a validator ?
Please help
Beta Was this translation helpful? Give feedback.
All reactions