Menu

TablesNamesFinder for different statements

2008-10-13
2012-12-07
  • Nobody/Anonymous

    Hello,

    I just found your project and I am well impressed and thankful for your effort. So far, I have been trying to obtain the names of all the affected tables but not only on selects but on any statement, can anyone give me a lead?

    Thank you in advance.

     
    • Leonardo Francalanci

      Have TablesNamesFinder implements StatementVisitor too.
      Then implement each visit method required by StatementVisitor. Something like this:

      in TablesNamesFinder:

          public List getTableList(Statement stm) {
              tables = new ArrayList();
              stm.accept(this);
              return tables;
          }

      public void visit(Insert insert)
      {
        Table table = insert.getTable();
      tables.add(table.getWholeTableName());
      }

       
    • Nobody/Anonymous

      OP here, thank you very much for your assistance.

       

Log in to post a comment.