001package gudusoft.gsqlparser.stmt; 002 003import gudusoft.gsqlparser.*; 004import gudusoft.gsqlparser.nodes.TExpression; 005import gudusoft.gsqlparser.nodes.TParseTreeVisitor; 006import gudusoft.gsqlparser.nodes.TWhileSqlNode; 007import gudusoft.gsqlparser.stmt.TBlockSqlStatement; 008 009public class TWhileStmt extends TBlockSqlStatement { 010 public TWhileStmt(EDbVendor dbvendor){ 011 super(dbvendor); 012 sqlstatementtype = ESqlStatementType.sstWhilestmt ; 013 } 014 015 void buildsql() { 016 } 017 018 void clear() { 019 } 020 021 String getasprettytext() { 022 return ""; 023 } 024 025 void iterate(TVisitorAbs pvisitor) { 026 } 027 028 public int doParseStatement(TCustomSqlStatement psql) { 029 if (rootNode == null) return -1; 030 TWhileSqlNode whileSqlNode = (TWhileSqlNode)rootNode; 031 super.doParseStatement(psql); 032 033 this.condition = whileSqlNode.getCondition(); 034 setLabelName(whileSqlNode.getLabelName()); 035 036 whileSqlNode.getStmts().doParse(this,ESqlClause.unknown); 037 for(int i=0;i<whileSqlNode.getStmts().size();i++){ 038 this.getBodyStatements().add(whileSqlNode.getStmts().getStatementSqlNode(i).getStmt()); 039 } 040 041 return 0; 042 } 043 044 public TExpression getCondition() { 045 return condition; 046 } 047 048 private TExpression condition = null; 049 050 public void accept(TParseTreeVisitor v){ 051 v.preVisit(this); 052 v.postVisit(this); 053 } 054 055 public void acceptChildren(TParseTreeVisitor v){ 056 v.preVisit(this); 057 condition.accept(v); 058 getBodyStatements().accept(v); 059 v.postVisit(this); 060 } 061 062 public void setCondition(TExpression condition) { 063 this.condition = condition; 064 } 065}