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.SQLStartTransactionStatement;
17 
18 import hunt.collection;
19 
20 import hunt.sql.ast;
21 // import hunt.sql.dialect.mysql.ast.statement.MySqlStatementImpl;
22 // import hunt.sql.dialect.mysql.visitor.MySqlASTVisitor;
23 import hunt.sql.visitor.SQLASTVisitor;
24 
25 public class SQLStartTransactionStatement : SQLStatementImpl {
26 
27     private bool              consistentSnapshot = false;
28 
29     private bool              begin              = false;
30     private bool              work               = false;
31     private SQLExpr              name;
32 
33     private List!SQLCommentHint hints;
34 
35     public bool isConsistentSnapshot() {
36         return consistentSnapshot;
37     }
38 
39     public void setConsistentSnapshot(bool consistentSnapshot) {
40         this.consistentSnapshot = consistentSnapshot;
41     }
42 
43     public bool isBegin() {
44         return begin;
45     }
46 
47     public void setBegin(bool begin) {
48         this.begin = begin;
49     }
50 
51     public bool isWork() {
52         return work;
53     }
54 
55     public void setWork(bool work) {
56         this.work = work;
57     }
58 
59     override public void accept0(SQLASTVisitor visitor) {
60         visitor.visit(this);
61 
62         visitor.endVisit(this);
63     }
64 
65     public List!SQLCommentHint getHints() {
66         return hints;
67     }
68 
69     public void setHints(List!SQLCommentHint hints) {
70         this.hints = hints;
71     }
72 
73     public SQLExpr getName() {
74         return name;
75     }
76 
77     public void setName(SQLExpr name) {
78         if (name !is null) {
79             name.setParent(this);
80         }
81         this.name = name;
82     }
83 
84     override
85     public List!SQLObject getChildren() {
86         if (name !is null) {
87             return Collections.singletonList!SQLObject(name);
88         }
89         return Collections.emptyList!(SQLObject)();
90     }
91 }