001package gudusoft.gsqlparser.stmt.oracle;
002
003
004import gudusoft.gsqlparser.*;
005import gudusoft.gsqlparser.nodes.*;
006import gudusoft.gsqlparser.nodes.oracle.TCompoundTriggerBodyNode;
007import gudusoft.gsqlparser.nodes.oracle.TTimingPoint;
008import gudusoft.gsqlparser.stmt.TCommonStoredProcedureSqlStatement;
009
010public class TCompoundTriggerBody  extends TCommonStoredProcedureSqlStatement {
011
012    public TCompoundTriggerBody(){
013        this(EDbVendor.dbvoracle);
014    }
015
016    public TCompoundTriggerBody(EDbVendor dbvendor){
017        super(dbvendor);
018        sqlstatementtype = ESqlStatementType.sstOracleCompoundTriggerBody ;
019    }
020
021    void buildsql() {
022    }
023
024    void clear() {
025    }
026
027    String getasprettytext() {
028        return "";
029    }
030
031    void iterate(TVisitorAbs pvisitor) {
032    }
033
034
035    private TPTNodeList <TTimingPoint> timingPointList = null;
036
037    public TPTNodeList<TTimingPoint> getTimingPointList() {
038        return timingPointList;
039    }
040
041    public int doParseStatement(TCustomSqlStatement psql) {
042        TCompoundTriggerBodyNode blockSqlNode = (TCompoundTriggerBodyNode)rootNode;
043
044        super.doParseStatement(psql);
045
046        if (blockSqlNode.getDeclareStmts() != null){
047            blockSqlNode.getDeclareStmts().doParse(this,ESqlClause.unknown);
048
049            for(int i=0;i<blockSqlNode.getDeclareStmts().size();i++){
050                this.getDeclareStatements().add(blockSqlNode.getDeclareStmts().getStatementSqlNode(i).getStmt());
051            }
052            // push variable declare into symbolTable
053            for(int i=0;i<blockSqlNode.getDeclareStmts().size();i++){
054                this.getTopStatement().getSymbolTable().push( new TSymbolTableItem(TObjectName.ttobjVariable,this,blockSqlNode.getDeclareStmts().getStatementSqlNode(i).getStmt() ));
055            }
056
057        }
058
059        for(int i=0;i<blockSqlNode.getTimingPointList().size();i++){
060            blockSqlNode.getTimingPointList().getElement(i).doParse(this,ESqlClause.unknown);
061        }
062
063        timingPointList = blockSqlNode.getTimingPointList();
064
065        if (blockSqlNode.getDeclareStmts() != null){
066
067            // pop variable declare from symbolTable
068            for(int i=0;i<blockSqlNode.getDeclareStmts().size();i++){
069                this.getTopStatement().getSymbolTable().pop();
070            }
071
072        }
073
074        return 0;
075
076    }
077
078    public void accept(TParseTreeVisitor v){
079        v.preVisit(this);
080        v.postVisit(this);
081    }
082
083    public void acceptChildren(TParseTreeVisitor v){
084        v.preVisit(this);
085        v.postVisit(this);
086    }
087
088    public void setTimingPointList(TPTNodeList<TTimingPoint> timingPointList) {
089        this.timingPointList = timingPointList;
090    }
091}
092