public String getSqlKeywords() { return SqlParser.create("").getMetadata().getJdbcKeywords(); }
/** * Creates a <code>SqlParser</code> to parse the given string using * Optiq's parser implementation. * * @param s An SQL statement or expression to parse. * @return A <code>SqlParser</code> object. */ public static SqlParser create(String s) { return create(SqlParserImpl.FACTORY, s, Quoting.DOUBLE_QUOTE, Casing.TO_UPPER, Casing.UNCHANGED); }
SqlParserPos getPos() throws ParseException { return new SqlParserPos( token.beginLine, token.beginColumn, token.endLine, token.endColumn); }
/** * Combines this parser position with another to create a position which * spans from the first point in the first to the last point in the other. */ public SqlParserPos plus(SqlParserPos pos) { return new SqlParserPos( getLineNum(), getColumnNum(), pos.getEndLineNum(), pos.getEndColumnNum()); }
/** * Combines this parser position with an array of positions to create a * position which spans from the first point in the first to the last point * in the other. */ public SqlParserPos plusAll(SqlNode [] nodes) { int line = getLineNum(); int column = getColumnNum(); int endLine = getEndLineNum(); int endColumn = getEndColumnNum(); return sum(nodes, line, column, endLine, endColumn); }
public SqlNode parseQuery(String sql) throws SqlParseException { SqlParser parser = new SqlParser(sql); return parser.parseQuery(); }
protected SqlNode parseStmt(String sql) throws SqlParseException { return getSqlParser(sql).parseStmt(); }
protected void checkFails( String sql, String expectedMsgPattern) { getTester().checkFails(sql, expectedMsgPattern); }
/** * Tests that an expression throws an exception which matches the given * pattern. */ protected void checkExpFails( String sql, String expectedMsgPattern) { getTester().checkExpFails(sql, expectedMsgPattern); }
protected SqlNode parseExpression(String sql) throws SqlParseException { return getSqlParser(sql).parseExpression(); }
/** * Get the parser metadata. * * @return {@link SqlAbstractParserImpl.Metadata} implementation of * underlying parser. */ public SqlAbstractParserImpl.Metadata getMetadata() { return parser.getMetadata(); } }
/** * Combines an array of parser positions to create a position which spans * from the beginning of the first to the end of the last. */ public static SqlParserPos sum( SqlParserPos[] poses) { return sum(poses, Integer.MAX_VALUE, Integer.MAX_VALUE, -1, -1); }
public void _testDerivedColumnListInJoin() { check( "select * from emp as e (empno, gender) join dept (deptno, dname) on emp.deptno = dept.deptno", "foo"); }
public String getSqlKeywords() { return SqlParser.create("").getMetadata().getJdbcKeywords(); }
protected void checkFails( String sql, String expectedMsgPattern) { getTester().checkFails(sql, expectedMsgPattern); }
/** * Tests that an expression throws an exception which matches the given * pattern. */ protected void checkExpFails( String sql, String expectedMsgPattern) { getTester().checkExpFails(sql, expectedMsgPattern); }