1 module hunt.sql.ast.SQLPartitionByRange; 2 3 import hunt.sql.visitor.SQLASTVisitor; 4 import hunt.sql.ast.SQLExpr; 5 import hunt.sql.ast.SQLPartitionBy; 6 import hunt.collection; 7 import hunt.sql.ast.SQLObject; 8 import hunt.sql.ast.SQLName; 9 import hunt.sql.ast.SQLPartition; 10 11 public class SQLPartitionByRange : SQLPartitionBy { 12 protected SQLExpr interval; 13 14 public this() { 15 16 } 17 18 public SQLExpr getInterval() { 19 return interval; 20 } 21 22 public void setInterval(SQLExpr interval) { 23 if (interval !is null) { 24 interval.setParent(this); 25 } 26 27 this.interval = interval; 28 } 29 30 protected override void accept0(SQLASTVisitor visitor) { 31 if (visitor.visit(this)) { 32 acceptChild!SQLExpr(visitor, columns); 33 acceptChild(visitor, interval); 34 acceptChild!SQLName(visitor, storeIn); 35 acceptChild!SQLPartition(visitor, partitions); 36 } 37 visitor.endVisit(this); 38 } 39 40 public override SQLPartitionByRange clone() { 41 SQLPartitionByRange x = new SQLPartitionByRange(); 42 43 if (interval !is null) { 44 x.setInterval(interval.clone()); 45 } 46 47 foreach (SQLExpr column ; columns) { 48 SQLExpr c2 = column.clone(); 49 c2.setParent(x); 50 x.columns.add(c2); 51 } 52 53 return x; 54 } 55 }