Skip to content

Commit

Permalink
added some doc to CCJSqlParserUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
wumpz committed Nov 13, 2019
1 parent 3cdea6b commit 5242a18
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/net/sf/jsqlparser/parser/CCJSqlParserUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ public static Statement parse(String sql) throws JSQLParserException {
return parse(sql, null);
}

/**
* Parses an sql statement while allowing via consumer to configure the used parser before.
*
* For instance to activate SQLServer bracket quotation on could use:
*
* {@code
* CCJSqlParserUtil.parse("select * from [mytable]", parser -> parser.withSquareBracketQuotation(true));
* }
*
* @param sql
* @param consumer
* @return
* @throws JSQLParserException
*/
public static Statement parse(String sql, Consumer<CCJSqlParser> consumer) throws JSQLParserException {
CCJSqlParser parser = new CCJSqlParser(new StringProvider(sql));
if (consumer != null) {
Expand Down

0 comments on commit 5242a18

Please sign in to comment.