001    package railo.runtime.db;
002    
003    import java.util.HashSet;
004    import java.util.Set;
005    
006    import railo.runtime.sql.SQLParserException;
007    import railo.runtime.sql.SelectParser;
008    import railo.runtime.sql.Selects;
009    import railo.runtime.sql.exp.Column;
010    
011    public class HSQLUtil2 {
012    
013            private Selects selects;
014    
015            public HSQLUtil2(SQL sql) throws SQLParserException {
016                    selects = new SelectParser().parse(sql.getSQLString());
017            }
018    
019            public HSQLUtil2(Selects selects) {
020                    this.selects = selects;
021            }
022    
023            public boolean isUnion() {
024                    return selects.getSelects().length>1;
025            }
026    
027            public Set<String> getInvokedTables() {
028                    HashSet<String> set=new HashSet<String>();
029                    Column[] tables = selects.getTables();
030                    for(int i=0;i<tables.length;i++) {
031                            set.add(tables[i].getFullName());
032                    }               
033                    return set;
034            }
035    
036    }