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.MySqlAlterEventStatement;
17 
18 import hunt.sql.ast.SQLExpr;
19 import hunt.sql.ast.SQLName;
20 import hunt.sql.ast.SQLStatement;
21 import hunt.sql.ast.statement.SQLAlterStatement;
22 import hunt.sql.dialect.mysql.visitor.MySqlASTVisitor;
23 import hunt.sql.util.DBType;
24 import hunt.sql.dialect.mysql.ast.statement.MySqlStatementImpl;
25 import hunt.sql.dialect.mysql.ast.statement.MySqlEventSchedule;
26 import hunt.Boolean;
27 
28 public class MySqlAlterEventStatement : MySqlStatementImpl , SQLAlterStatement {
29     alias accept0 = MySqlStatementImpl.accept0;
30     
31     private SQLName            definer;
32     private SQLName            name;
33 
34     private MySqlEventSchedule schedule;
35     private bool            onCompletionPreserve;
36     private SQLName            renameTo;
37     private Boolean            enable;
38     private bool            disableOnSlave;
39     private SQLExpr            comment;
40     private SQLStatement       eventBody;
41 
42     public this() {
43         setDbType(DBType.MYSQL.name);
44     }
45 
46     override public void accept0(MySqlASTVisitor visitor) {
47         if (visitor.visit(this)) {
48             acceptChild(visitor, definer);
49             acceptChild(visitor, name);
50             acceptChild(visitor, schedule);
51             acceptChild(visitor, renameTo);
52             acceptChild(visitor, comment);
53             acceptChild(visitor, eventBody);
54         }
55         visitor.endVisit(this);
56     }
57 
58     public SQLName getDefiner() {
59         return definer;
60     }
61 
62     public void setDefiner(SQLName definer) {
63         if (definer !is null) {
64             definer.setParent(this);
65         }
66         this.definer = definer;
67     }
68 
69     public SQLName getName() {
70         return name;
71     }
72 
73     public void setName(SQLName name) {
74         if (name !is null) {
75             name.setParent(this);
76         }
77         this.name = name;
78     }
79 
80     public MySqlEventSchedule getSchedule() {
81         return schedule;
82     }
83 
84     public void setSchedule(MySqlEventSchedule schedule) {
85         if (schedule !is null) {
86             schedule.setParent(this);
87         }
88         this.schedule = schedule;
89     }
90 
91     public bool isOnCompletionPreserve() {
92         return onCompletionPreserve;
93     }
94 
95     public void setOnCompletionPreserve(bool onCompletionPreserve) {
96         this.onCompletionPreserve = onCompletionPreserve;
97     }
98 
99     public SQLName getRenameTo() {
100         return renameTo;
101     }
102 
103     public void setRenameTo(SQLName renameTo) {
104         if (renameTo !is null) {
105             renameTo.setParent(this);
106         }
107         this.renameTo = renameTo;
108     }
109 
110     public Boolean getEnable() {
111         return enable;
112     }
113 
114     public void setEnable(Boolean enable) {
115         this.enable = enable;
116     }
117 
118     public bool isDisableOnSlave() {
119         return disableOnSlave;
120     }
121 
122     public void setDisableOnSlave(bool disableOnSlave) {
123         this.disableOnSlave = disableOnSlave;
124     }
125 
126     public SQLExpr getComment() {
127         return comment;
128     }
129 
130     public void setComment(SQLExpr comment) {
131         if (comment !is null) {
132             comment.setParent(this);
133         }
134         this.comment = comment;
135     }
136 
137     public SQLStatement getEventBody() {
138         return eventBody;
139     }
140 
141     public void setEventBody(SQLStatement eventBody) {
142         if (eventBody !is null) {
143             eventBody.setParent(this);
144         }
145         this.eventBody = eventBody;
146     }
147 }