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.MySqlAnalyzeStatement;
17 
18 
19 import hunt.collection;
20 import hunt.sql.ast.SQLObject;
21 
22 import hunt.sql.ast.statement.SQLExprTableSource;
23 import hunt.sql.dialect.mysql.visitor.MySqlASTVisitor;
24 import hunt.sql.dialect.mysql.ast.statement.MySqlStatementImpl;
25 
26 public class MySqlAnalyzeStatement : MySqlStatementImpl {
27 
28     alias accept0 = MySqlStatementImpl.accept0;
29 
30     private bool                          noWriteToBinlog = false;
31     private bool                          local           = false;
32 
33     protected  List!(SQLExprTableSource) tableSources;
34 
35     this()
36     {
37         tableSources    = new ArrayList!(SQLExprTableSource)();
38     }
39 
40     override public void accept0(MySqlASTVisitor visitor) {
41         if (visitor.visit(this)) {
42             acceptChild!SQLExprTableSource(visitor, tableSources);
43         }
44         visitor.endVisit(this);
45     }
46 
47     public bool isNoWriteToBinlog() {
48         return noWriteToBinlog;
49     }
50 
51     public void setNoWriteToBinlog(bool noWriteToBinlog) {
52         this.noWriteToBinlog = noWriteToBinlog;
53     }
54 
55     public bool isLocal() {
56         return local;
57     }
58 
59     public void setLocal(bool local) {
60         this.local = local;
61     }
62 
63     public List!(SQLExprTableSource) getTableSources() {
64         return tableSources;
65     }
66 
67     public void addTableSource(SQLExprTableSource tableSource) {
68         if (tableSource !is null) {
69             tableSource.setParent(this);
70         }
71         this.tableSources.add(tableSource);
72     }
73 }