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.ast.statement.SQLDropSynonymStatement; 17 18 import hunt.sql.ast.SQLName; 19 import hunt.sql.ast.SQLObject; 20 import hunt.sql.ast.SQLStatementImpl; 21 import hunt.sql.ast.expr.SQLPropertyExpr; 22 import hunt.sql.visitor.SQLASTVisitor; 23 import hunt.sql.ast.statement.SQLDropStatement; 24 25 26 import hunt.collection; 27 28 public class SQLDropSynonymStatement : SQLStatementImpl , SQLDropStatement { 29 30 private SQLName name; 31 private bool ifExists; 32 private bool _isPublic; 33 private bool force; 34 35 public this() { 36 37 } 38 39 public this(string dbType) { 40 super (dbType); 41 } 42 43 44 override protected void accept0(SQLASTVisitor visitor) { 45 if (visitor.visit(this)) { 46 acceptChild(visitor, name); 47 } 48 visitor.endVisit(this); 49 } 50 51 override 52 public List!SQLObject getChildren() { 53 List!SQLObject children = new ArrayList!SQLObject(); 54 if (name !is null) { 55 children.add(name); 56 } 57 return children; 58 } 59 60 public SQLName getName() { 61 return name; 62 } 63 64 public void setName(SQLName name) { 65 this.name = name; 66 } 67 68 public bool isIfExists() { 69 return ifExists; 70 } 71 72 public void setIfExists(bool ifExists) { 73 this.ifExists = ifExists; 74 } 75 76 public string getSchema() { 77 SQLName name = getName(); 78 if (name is null) { 79 return null; 80 } 81 82 if (cast(SQLPropertyExpr)(name) !is null ) { 83 return (cast(SQLPropertyExpr) name).getOwnernName(); 84 } 85 86 return null; 87 } 88 89 public bool isPublic() { 90 return _isPublic; 91 } 92 93 public void setPublic(bool aPublic) { 94 _isPublic = aPublic; 95 } 96 97 public bool isForce() { 98 return force; 99 } 100 101 public void setForce(bool force) { 102 this.force = force; 103 } 104 }