Search in sources :

Example 1 with BindableStatement

use of org.apache.phoenix.parse.BindableStatement in project phoenix by apache.

the class BaseConnectionlessQueryTest method assertRoundtrip.

protected static void assertRoundtrip(String sql) throws SQLException {
    SQLParser parser = new SQLParser(sql);
    BindableStatement stmt = null;
    stmt = parser.parseStatement();
    if (stmt.getOperation() != Operation.QUERY) {
        return;
    }
    String newSQL = stmt.toString();
    SQLParser newParser = new SQLParser(newSQL);
    BindableStatement newStmt = null;
    try {
        newStmt = newParser.parseStatement();
    } catch (SQLException e) {
        fail("Unable to parse new:\n" + newSQL);
    }
    assertEquals("Expected equality:\n" + sql + "\n" + newSQL, stmt, newStmt);
}
Also used : SQLParser(org.apache.phoenix.parse.SQLParser) SQLException(java.sql.SQLException) BindableStatement(org.apache.phoenix.parse.BindableStatement)

Aggregations

SQLException (java.sql.SQLException)1 BindableStatement (org.apache.phoenix.parse.BindableStatement)1 SQLParser (org.apache.phoenix.parse.SQLParser)1