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.mysql.ast.statement.MySqlKillStatement;
17 
18 
19 
20 import hunt.collection;
21 
22 import hunt.sql.ast.SQLExpr;
23 import hunt.sql.ast.SQLObject;
24 import hunt.sql.dialect.mysql.visitor.MySqlASTVisitor;
25 import hunt.sql.dialect.mysql.ast.statement.MySqlStatementImpl;
26 
27 public class MySqlKillStatement : MySqlStatementImpl {
28 
29     alias accept0 = MySqlStatementImpl.accept0;
30     
31     private Type          type;
32     private List!(SQLExpr) threadIds;
33 
34     public static enum Type {
35                              CONNECTION, QUERY
36     }
37 
38     this()
39     {
40         threadIds = new ArrayList!(SQLExpr)();
41     }
42 
43     public Type getType() {
44         return type;
45     }
46 
47     public void setType(Type type) {
48         this.type = type;
49     }
50 
51     public SQLExpr getThreadId() {
52         return threadIds.get(0);
53     }
54 
55     public void setThreadId(SQLExpr threadId) {
56         this.threadIds.set(0, threadId);
57     }
58     
59     public List!(SQLExpr) getThreadIds() {
60         return threadIds;
61     }
62 
63     override public void accept0(MySqlASTVisitor visitor) {
64         if (visitor.visit(this)) {
65             acceptChild(visitor, cast(List!(SQLObject))threadIds);
66         }
67         visitor.endVisit(this);
68     }
69 
70     override
71     public List!(SQLObject) getChildren() {
72         return Collections.emptyList!(SQLObject)();
73     }
74 }