1 module hunt.sql.ast.SQLPartitionByHash; 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 SQLPartitionByHash : SQLPartitionBy { 12 13 alias cloneTo = SQLPartitionBy.cloneTo; 14 // for aliyun ads 15 protected bool key; 16 protected bool unique; 17 18 public bool isKey() { 19 return key; 20 } 21 22 public void setKey(bool key) { 23 this.key = key; 24 } 25 26 public bool isUnique() { 27 return unique; 28 } 29 30 public void setUnique(bool unique) { 31 this.unique = unique; 32 } 33 34 protected override void accept0(SQLASTVisitor visitor) { 35 if (visitor.visit(this)) { 36 acceptChild(visitor, partitionsCount); 37 acceptChild!SQLPartition(visitor, getPartitions()); 38 acceptChild(visitor, subPartitionBy); 39 } 40 visitor.endVisit(this); 41 } 42 43 public override SQLPartitionByHash clone() { 44 SQLPartitionByHash x = new SQLPartitionByHash(); 45 46 this.cloneTo(x); 47 48 x.key = key; 49 x.unique = unique; 50 51 foreach (SQLExpr column ; columns) { 52 SQLExpr c2 = column.clone(); 53 c2.setParent(x); 54 x.columns.add(c2); 55 } 56 57 return x; 58 } 59 60 public void cloneTo(SQLPartitionByHash x) { 61 super.cloneTo(cast(SQLPartitionBy)x); 62 } 63 }