@Test public void parsesDdlQueries() { String sql = "drop table Blarg"; assertThat(StatementParser.getStatementType(sql)).isEqualTo(StatementType.DDL); sql = "CREATE table foobar5000"; assertThat(StatementParser.getStatementType(sql)).isEqualTo(StatementType.DDL); sql = "ALTER TABLE table Add Column name STRING"; assertThat(StatementParser.getStatementType(sql)).isEqualTo(StatementType.DDL); }
public static StatementType getStatementType(String sql) { if (clientLibraryParser.isQuery(sql)) { return StatementType.SELECT; } else if (clientLibraryParser.isDdlStatement(sql)) { return StatementType.DDL; } else if (clientLibraryParser.isUpdateStatement(sql)) { return StatementType.DML; } else { return StatementType.UNKNOWN; } }
StatementParser { public static StatementType getStatementType(String sql) { if (clientLibraryParser.isQuery(sql)) { return StatementType.SELECT; } else if (clientLibraryParser.isDdlStatement(sql)) { return StatementType.DDL; } else if (clientLibraryParser.isUpdateStatement(sql)) { return StatementType.DML; } else { return StatementType.UNKNOWN; } } }
StatementParser { public static StatementType getStatementType(String sql) { if (clientLibraryParser.isQuery(sql)) { return StatementType.SELECT; } else if (clientLibraryParser.isDdlStatement(sql)) { return StatementType.DDL; } else if (clientLibraryParser.isUpdateStatement(sql)) { return StatementType.DML; } else { return StatementType.UNKNOWN; } } private  StatementParser(); }
StatementParser { public static StatementType getStatementType(String sql) { if (clientLibraryParser.isQuery(sql)) { return StatementType.SELECT; } else if (clientLibraryParser.isDdlStatement(sql)) { return StatementType.DDL; } else if (clientLibraryParser.isUpdateStatement(sql)) { return StatementType.DML; } else { return StatementType.UNKNOWN; } } private  StatementParser(); static StatementType getStatementType(String sql); }
StatementParser { public static StatementType getStatementType(String sql) { if (clientLibraryParser.isQuery(sql)) { return StatementType.SELECT; } else if (clientLibraryParser.isDdlStatement(sql)) { return StatementType.DDL; } else if (clientLibraryParser.isUpdateStatement(sql)) { return StatementType.DML; } else { return StatementType.UNKNOWN; } } private  StatementParser(); static StatementType getStatementType(String sql);  }