/** * 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); }
/** Sets configuration identical to a given {@link Config}. */ public ConfigBuilder setConfig(Config config) { this.quotedCasing = config.quotedCasing(); this.unquotedCasing = config.unquotedCasing(); this.quoting = config.quoting(); this.identifierMaxLength = config.identifierMaxLength(); this.conformance = config.conformance(); this.parserFactory = config.parserFactory(); return this; }
/** Sets configuration identical to a given {@link Config}. */ public ConfigBuilder setConfig(Config config) { this.quotedCasing = config.quotedCasing(); this.unquotedCasing = config.unquotedCasing(); this.quoting = config.quoting(); this.identifierMaxLength = config.identifierMaxLength(); this.conformance = config.conformance(); this.parserFactory = config.parserFactory(); return this; }