1 /* 2 * Copyright 2015-2018 HuntLabs.cn 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 module hunt.sql.dialect.postgresql.ast.stmt.PGUpdateStatement; 17 18 import hunt.sql.ast.statement.SQLUpdateStatement; 19 import hunt.sql.ast.statement.SQLWithSubqueryClause; 20 import hunt.sql.dialect.postgresql.visitor.PGASTVisitor; 21 import hunt.sql.visitor.SQLASTVisitor; 22 import hunt.sql.util.DBType; 23 import hunt.sql.dialect.postgresql.ast.stmt.PGSQLStatement; 24 import hunt.sql.ast.SQLObject; 25 import hunt.collection; 26 import hunt.sql.ast.statement.SQLUpdateSetItem; 27 28 public class PGUpdateStatement : SQLUpdateStatement , PGSQLStatement { 29 30 private bool only = false; 31 32 public this(){ 33 super (DBType.POSTGRESQL.name); 34 } 35 36 public bool isOnly() { 37 return only; 38 } 39 40 public void setOnly(bool only) { 41 this.only = only; 42 } 43 44 override protected void accept0(SQLASTVisitor visitor) { 45 if (cast(PGASTVisitor)(visitor) !is null) { 46 accept0(cast(PGASTVisitor) visitor); 47 return; 48 } 49 50 super.accept0(visitor); 51 } 52 53 override 54 public void accept0(PGASTVisitor visitor) { 55 if (visitor.visit(this)) { 56 acceptChild(visitor, _with); 57 acceptChild(visitor, tableSource); 58 acceptChild!SQLUpdateSetItem(visitor, items); 59 acceptChild(visitor, where); 60 } 61 visitor.endVisit(this); 62 } 63 64 }