/** * Creates a <code>SqlParser</code> to parse the given string using the * parser implementation created from given {@link SqlParserImplFactory} * with given quoting syntax and casing policies for identifiers. * * @param sql A SQL statement or expression to parse. * @param config The parser configuration (identifier max length, etc.) * @return A parser */ public static SqlParser create(String sql, Config config) { SqlAbstractParserImpl parser = config.parserFactory().getParser(new StringReader(sql)); return new SqlParser(sql, parser, config); }
/** * Creates a <code>SqlParser</code> to parse the given string using the * parser implementation created from given {@link SqlParserImplFactory} * with given quoting syntax and casing policies for identifiers. * * <p>Unlike * {@link #create(java.lang.String, org.apache.calcite.sql.parser.SqlParser.Config)}, * the parser is not able to return the original query string, but will * instead return "?". * * @param reader The source for the SQL statement or expression to parse * @param config The parser configuration (identifier max length, etc.) * @return A parser */ public static SqlParser create(Reader reader, Config config) { SqlAbstractParserImpl parser = config.parserFactory().getParser(reader); return new SqlParser(parser, config); }