@Test public void findJdbcParamExpressions() throws Exception { String sql = "DELETE FROM person WHERE id = ?"; Set<Expression> expressionSet = KbSqlParser.findBindArgsExpressions(sql); System.out.println(); }
protected static Set<Expression> findBindArgsExpressions(String sql) { if (sql == null || sql.startsWith("PRAGMA") || !sql.contains("?")) { return new LinkedHashSet<>(); } KbSqlParserManager pm = new KbSqlParserManager(); try { Statement statement = pm.parse(sql); Set<Expression> expressionSet = findBindArgsExpressions(statement); return expressionSet; } catch (JSQLParserException e) { e.printStackTrace(); } return new LinkedHashSet<>(); }
KbSqlParser { protected static Set<Expression> findBindArgsExpressions(String sql) { if (sql == null || sql.startsWith("PRAGMA") || !sql.contains("?")) { return new LinkedHashSet<>(); } KbSqlParserManager pm = new KbSqlParserManager(); try { Statement statement = pm.parse(sql); Set<Expression> expressionSet = findBindArgsExpressions(statement); return expressionSet; } catch (JSQLParserException e) { e.printStackTrace(); } return new LinkedHashSet<>(); } }
KbSqlParser { protected static Set<Expression> findBindArgsExpressions(String sql) { if (sql == null || sql.startsWith("PRAGMA") || !sql.contains("?")) { return new LinkedHashSet<>(); } KbSqlParserManager pm = new KbSqlParserManager(); try { Statement statement = pm.parse(sql); Set<Expression> expressionSet = findBindArgsExpressions(statement); return expressionSet; } catch (JSQLParserException e) { e.printStackTrace(); } return new LinkedHashSet<>(); }  }
KbSqlParser { protected static Set<Expression> findBindArgsExpressions(String sql) { if (sql == null || sql.startsWith("PRAGMA") || !sql.contains("?")) { return new LinkedHashSet<>(); } KbSqlParserManager pm = new KbSqlParserManager(); try { Statement statement = pm.parse(sql); Set<Expression> expressionSet = findBindArgsExpressions(statement); return expressionSet; } catch (JSQLParserException e) { e.printStackTrace(); } return new LinkedHashSet<>(); }  static String bindArgs(String sql, @Nullable Object[] bindArgs); }
KbSqlParser { protected static Set<Expression> findBindArgsExpressions(String sql) { if (sql == null || sql.startsWith("PRAGMA") || !sql.contains("?")) { return new LinkedHashSet<>(); } KbSqlParserManager pm = new KbSqlParserManager(); try { Statement statement = pm.parse(sql); Set<Expression> expressionSet = findBindArgsExpressions(statement); return expressionSet; } catch (JSQLParserException e) { e.printStackTrace(); } return new LinkedHashSet<>(); }  static String bindArgs(String sql, @Nullable Object[] bindArgs);  }