@Test public void testCreateLabelDml() { assertEquals("JDBC DML", JdbcOperationFinalizer.createLabel("CREATE INMEMORY TABLE FUBAR(BAZ)")); assertEquals("JDBC DML", JdbcOperationFinalizer.createLabel("CREATE USER BARFO")); }
public static String createLabel(String sql) { if (StringUtil.isEmpty(sql)) { return "JDBC"; } String upperSql = sql.toUpperCase().trim(); for (Map.Entry<String, String> stmt : stmtsList) { String kwd = stmt.getKey(); if (!upperSql.startsWith(kwd)) { continue; } String argPos = stmt.getValue(); return appendArgumentValue("JDBC " + kwd, captureWordAfter(upperSql, argPos)); } if (upperSql.startsWith("CREATE")) { return "JDBC DML"; } else if (upperSql.startsWith("CHECKPOINT")) { return "JDBC CHECKPOINT"; } else { return "JDBC STATEMENT"; } }
JdbcOperationFinalizer { public static String createLabel(String sql) { if (StringUtil.isEmpty(sql)) { return "JDBC"; } String upperSql = sql.toUpperCase().trim(); for (Map.Entry<String, String> stmt : stmtsList) { String kwd = stmt.getKey(); if (!upperSql.startsWith(kwd)) { continue; } String argPos = stmt.getValue(); return appendArgumentValue("JDBC " + kwd, captureWordAfter(upperSql, argPos)); } if (upperSql.startsWith("CREATE")) { return "JDBC DML"; } else if (upperSql.startsWith("CHECKPOINT")) { return "JDBC CHECKPOINT"; } else { return "JDBC STATEMENT"; } } }
JdbcOperationFinalizer { public static String createLabel(String sql) { if (StringUtil.isEmpty(sql)) { return "JDBC"; } String upperSql = sql.toUpperCase().trim(); for (Map.Entry<String, String> stmt : stmtsList) { String kwd = stmt.getKey(); if (!upperSql.startsWith(kwd)) { continue; } String argPos = stmt.getValue(); return appendArgumentValue("JDBC " + kwd, captureWordAfter(upperSql, argPos)); } if (upperSql.startsWith("CREATE")) { return "JDBC DML"; } else if (upperSql.startsWith("CHECKPOINT")) { return "JDBC CHECKPOINT"; } else { return "JDBC STATEMENT"; } } private  JdbcOperationFinalizer(); }
JdbcOperationFinalizer { public static String createLabel(String sql) { if (StringUtil.isEmpty(sql)) { return "JDBC"; } String upperSql = sql.toUpperCase().trim(); for (Map.Entry<String, String> stmt : stmtsList) { String kwd = stmt.getKey(); if (!upperSql.startsWith(kwd)) { continue; } String argPos = stmt.getValue(); return appendArgumentValue("JDBC " + kwd, captureWordAfter(upperSql, argPos)); } if (upperSql.startsWith("CREATE")) { return "JDBC DML"; } else if (upperSql.startsWith("CHECKPOINT")) { return "JDBC CHECKPOINT"; } else { return "JDBC STATEMENT"; } } private  JdbcOperationFinalizer(); static void addParam(Operation operation, String key, Object param); static void addParam(Operation operation, int paramIndex, Object param); static Operation finalize(Operation operation); static String createLabel(String sql); }
JdbcOperationFinalizer { public static String createLabel(String sql) { if (StringUtil.isEmpty(sql)) { return "JDBC"; } String upperSql = sql.toUpperCase().trim(); for (Map.Entry<String, String> stmt : stmtsList) { String kwd = stmt.getKey(); if (!upperSql.startsWith(kwd)) { continue; } String argPos = stmt.getValue(); return appendArgumentValue("JDBC " + kwd, captureWordAfter(upperSql, argPos)); } if (upperSql.startsWith("CREATE")) { return "JDBC DML"; } else if (upperSql.startsWith("CHECKPOINT")) { return "JDBC CHECKPOINT"; } else { return "JDBC STATEMENT"; } } private  JdbcOperationFinalizer(); static void addParam(Operation operation, String key, Object param); static void addParam(Operation operation, int paramIndex, Object param); static Operation finalize(Operation operation); static String createLabel(String sql); static final String PARAMS_VALUES; }