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.SQLDropUserStatement;
17 
18 
19 import hunt.collection;
20 
21 import hunt.sql.ast.SQLExpr;
22 import hunt.sql.ast.SQLObject;
23 import hunt.sql.ast.SQLStatementImpl;
24 import hunt.sql.visitor.SQLASTVisitor;
25 import hunt.sql.ast.statement.SQLDropStatement;
26 
27 public class SQLDropUserStatement : SQLStatementImpl , SQLDropStatement {
28 
29     private List!SQLExpr users;
30     
31     public this() {
32         users = new ArrayList!SQLExpr(2);
33     }
34     
35     public this(string dbType) {
36         users = new ArrayList!SQLExpr(2);
37         super (dbType);
38     }
39 
40     public List!SQLExpr getUsers() {
41         return users;
42     }
43 
44     public void addUser(SQLExpr user) {
45         if (user !is null) {
46             user.setParent(this);
47         }
48         this.users.add(user);
49     }
50 
51     override  protected void accept0(SQLASTVisitor visitor) {
52         if (visitor.visit(this)) {
53             acceptChild!SQLExpr(visitor, users);
54         }
55         visitor.endVisit(this);
56     }
57 
58     override
59     public List!SQLObject getChildren() {
60         return cast(List!SQLObject)users;
61     }
62 }