@Test public void parsesDmlQueries() { String sql = "InSeRt INTO TABLE_NAME VALUES (value1, value2, value3,...valueN)"; assertThat(StatementParser.getStatementType(sql)).isEqualTo(StatementType.DML); sql = "DELETE FROM target_name WHERE true"; assertThat(StatementParser.getStatementType(sql)).isEqualTo(StatementType.DML); sql = "UPDATE Singers\n" + "SET BirthDate = '1990-10-10'\n" + "WHERE FirstName = 'Marc' AND LastName = 'Richards'"; assertThat(StatementParser.getStatementType(sql)).isEqualTo(StatementType.DML); }
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);  }