@Test public void testGetTableListFromInsertValues() throws Exception { String sql = "INSERT INTO MY_TABLE1 (a) VALUES (5)"; net.sf.jsqlparser.statement.Statement statement = pm.parse(new StringReader(sql)); Insert insertStatement = (Insert) statement; TablesNamesFinder tablesNamesFinder = new TablesNamesFinder(); List<String> tableList = tablesNamesFinder.getTableList(insertStatement); assertEquals(1, tableList.size()); assertTrue(tableList.contains("MY_TABLE1")); }
public List<String> getTableList(Statement statement) { init(); statement.accept(this); return tables; }
TablesNamesFinder implements SelectVisitor, FromItemVisitor, ExpressionVisitor, ItemsListVisitor, SelectItemVisitor, StatementVisitor { public List<String> getTableList(Statement statement) { init(); statement.accept(this); return tables; } }
TablesNamesFinder implements SelectVisitor, FromItemVisitor, ExpressionVisitor, ItemsListVisitor, SelectItemVisitor, StatementVisitor { public List<String> getTableList(Statement statement) { init(); statement.accept(this); return tables; }  }
TablesNamesFinder implements SelectVisitor, FromItemVisitor, ExpressionVisitor, ItemsListVisitor, SelectItemVisitor, StatementVisitor { public List<String> getTableList(Statement statement) { init(); statement.accept(this); return tables; }  List<String> getTableList(Statement statement); @Override void visit(Select select); List<String> getTableList(Expression expr); @Override void visit(WithItem withItem); @Override void visit(PlainSelect plainSelect); @Override void visit(Table tableName); @Override void visit(SubSelect subSelect); @Override void visit(Addition addition); @Override void visit(AndExpression andExpression); @Override void visit(Between between); @Override void visit(Column tableColumn); @Override void visit(Division division); @Override void visit(DoubleValue doubleValue); @Override void visit(EqualsTo equalsTo); @Override void visit(Function function); @Override void visit(GreaterThan greaterThan); @Override void visit(GreaterThanEquals greaterThanEquals); @Override void visit(InExpression inExpression); @Override void visit(SignedExpression signedExpression); @Override void visit(IsNullExpression isNullExpression); @Override void visit(JdbcParameter jdbcParameter); @Override void visit(LikeExpression likeExpression); @Override void visit(ExistsExpression existsExpression); @Override void visit(LongValue longValue); @Override void visit(MinorThan minorThan); @Override void visit(MinorThanEquals minorThanEquals); @Override void visit(Multiplication multiplication); @Override void visit(NotEqualsTo notEqualsTo); @Override void visit(NullValue nullValue); @Override void visit(OrExpression orExpression); @Override void visit(Parenthesis parenthesis); @Override void visit(StringValue stringValue); @Override void visit(Subtraction subtraction); void visitBinaryExpression(BinaryExpression binaryExpression); @Override void visit(ExpressionList expressionList); @Override void visit(DateValue dateValue); @Override void visit(TimestampValue timestampValue); @Override void visit(TimeValue timeValue); @Override void visit(CaseExpression caseExpression); @Override void visit(WhenClause whenClause); @Override void visit(AllComparisonExpression allComparisonExpression); @Override void visit(AnyComparisonExpression anyComparisonExpression); @Override void visit(SubJoin subjoin); @Override void visit(Concat concat); @Override void visit(Matches matches); @Override void visit(BitwiseAnd bitwiseAnd); @Override void visit(BitwiseOr bitwiseOr); @Override void visit(BitwiseXor bitwiseXor); @Override void visit(CastExpression cast); @Override void visit(Modulo modulo); @Override void visit(AnalyticExpression analytic); @Override void visit(SetOperationList list); @Override void visit(ExtractExpression eexpr); @Override void visit(LateralSubSelect lateralSubSelect); @Override void visit(MultiExpressionList multiExprList); @Override void visit(ValuesList valuesList); @Override void visit(IntervalExpression iexpr); @Override void visit(JdbcNamedParameter jdbcNamedParameter); @Override void visit(OracleHierarchicalExpression oexpr); @Override void visit(RegExpMatchOperator rexpr); @Override void visit(RegExpMySQLOperator rexpr); @Override void visit(JsonExpression jsonExpr); @Override void visit(JsonOperator jsonExpr); @Override void visit(AllColumns allColumns); @Override void visit(AllTableColumns allTableColumns); @Override void visit(SelectExpressionItem item); @Override void visit(WithinGroupExpression wgexpr); @Override void visit(UserVariable var); @Override void visit(NumericBind bind); @Override void visit(KeepExpression aexpr); @Override void visit(MySQLGroupConcat groupConcat); @Override void visit(Delete delete); @Override void visit(Update update); @Override void visit(Insert insert); @Override void visit(Replace replace); @Override void visit(Drop drop); @Override void visit(Truncate truncate); @Override void visit(CreateIndex createIndex); @Override void visit(CreateTable create); @Override void visit(CreateView createView); @Override void visit(Alter alter); @Override void visit(Statements stmts); @Override void visit(Execute execute); @Override void visit(SetStatement set); @Override void visit(RowConstructor rowConstructor); @Override void visit(HexValue hexValue); @Override void visit(Merge merge); @Override void visit(OracleHint hint); @Override void visit(TableFunction valuesList); @Override void visit(AlterView alterView); @Override void visit(TimeKeyExpression timeKeyExpression); @Override void visit(DateTimeLiteralExpression literal); }
TablesNamesFinder implements SelectVisitor, FromItemVisitor, ExpressionVisitor, ItemsListVisitor, SelectItemVisitor, StatementVisitor { public List<String> getTableList(Statement statement) { init(); statement.accept(this); return tables; }  List<String> getTableList(Statement statement); @Override void visit(Select select); List<String> getTableList(Expression expr); @Override void visit(WithItem withItem); @Override void visit(PlainSelect plainSelect); @Override void visit(Table tableName); @Override void visit(SubSelect subSelect); @Override void visit(Addition addition); @Override void visit(AndExpression andExpression); @Override void visit(Between between); @Override void visit(Column tableColumn); @Override void visit(Division division); @Override void visit(DoubleValue doubleValue); @Override void visit(EqualsTo equalsTo); @Override void visit(Function function); @Override void visit(GreaterThan greaterThan); @Override void visit(GreaterThanEquals greaterThanEquals); @Override void visit(InExpression inExpression); @Override void visit(SignedExpression signedExpression); @Override void visit(IsNullExpression isNullExpression); @Override void visit(JdbcParameter jdbcParameter); @Override void visit(LikeExpression likeExpression); @Override void visit(ExistsExpression existsExpression); @Override void visit(LongValue longValue); @Override void visit(MinorThan minorThan); @Override void visit(MinorThanEquals minorThanEquals); @Override void visit(Multiplication multiplication); @Override void visit(NotEqualsTo notEqualsTo); @Override void visit(NullValue nullValue); @Override void visit(OrExpression orExpression); @Override void visit(Parenthesis parenthesis); @Override void visit(StringValue stringValue); @Override void visit(Subtraction subtraction); void visitBinaryExpression(BinaryExpression binaryExpression); @Override void visit(ExpressionList expressionList); @Override void visit(DateValue dateValue); @Override void visit(TimestampValue timestampValue); @Override void visit(TimeValue timeValue); @Override void visit(CaseExpression caseExpression); @Override void visit(WhenClause whenClause); @Override void visit(AllComparisonExpression allComparisonExpression); @Override void visit(AnyComparisonExpression anyComparisonExpression); @Override void visit(SubJoin subjoin); @Override void visit(Concat concat); @Override void visit(Matches matches); @Override void visit(BitwiseAnd bitwiseAnd); @Override void visit(BitwiseOr bitwiseOr); @Override void visit(BitwiseXor bitwiseXor); @Override void visit(CastExpression cast); @Override void visit(Modulo modulo); @Override void visit(AnalyticExpression analytic); @Override void visit(SetOperationList list); @Override void visit(ExtractExpression eexpr); @Override void visit(LateralSubSelect lateralSubSelect); @Override void visit(MultiExpressionList multiExprList); @Override void visit(ValuesList valuesList); @Override void visit(IntervalExpression iexpr); @Override void visit(JdbcNamedParameter jdbcNamedParameter); @Override void visit(OracleHierarchicalExpression oexpr); @Override void visit(RegExpMatchOperator rexpr); @Override void visit(RegExpMySQLOperator rexpr); @Override void visit(JsonExpression jsonExpr); @Override void visit(JsonOperator jsonExpr); @Override void visit(AllColumns allColumns); @Override void visit(AllTableColumns allTableColumns); @Override void visit(SelectExpressionItem item); @Override void visit(WithinGroupExpression wgexpr); @Override void visit(UserVariable var); @Override void visit(NumericBind bind); @Override void visit(KeepExpression aexpr); @Override void visit(MySQLGroupConcat groupConcat); @Override void visit(Delete delete); @Override void visit(Update update); @Override void visit(Insert insert); @Override void visit(Replace replace); @Override void visit(Drop drop); @Override void visit(Truncate truncate); @Override void visit(CreateIndex createIndex); @Override void visit(CreateTable create); @Override void visit(CreateView createView); @Override void visit(Alter alter); @Override void visit(Statements stmts); @Override void visit(Execute execute); @Override void visit(SetStatement set); @Override void visit(RowConstructor rowConstructor); @Override void visit(HexValue hexValue); @Override void visit(Merge merge); @Override void visit(OracleHint hint); @Override void visit(TableFunction valuesList); @Override void visit(AlterView alterView); @Override void visit(TimeKeyExpression timeKeyExpression); @Override void visit(DateTimeLiteralExpression literal);  }