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.SQLReturnStatement;
17 
18 import hunt.sql.ast.SQLExpr;
19 import hunt.sql.ast.SQLObject;
20 import hunt.sql.ast.SQLStatementImpl;
21 import hunt.sql.visitor.SQLASTVisitor;
22 
23 import hunt.collection;
24 
25 public class SQLReturnStatement : SQLStatementImpl {
26 
27     private SQLExpr expr;
28 
29     public this() {
30 
31     }
32 
33     public this(string dbType) {
34         super (dbType);
35     }
36 
37     public SQLExpr getExpr() {
38         return expr;
39     }
40 
41     public void setExpr(SQLExpr expr) {
42         if (expr !is null) {
43             expr.setParent(this);
44         }
45         this.expr = expr;
46     }
47 
48     
49     override  protected void accept0(SQLASTVisitor visitor) {
50         if (visitor.visit(this)) {
51             acceptChild(visitor, expr);
52         }
53         visitor.endVisit(this);
54     }
55 
56     override public SQLReturnStatement clone() {
57         SQLReturnStatement x = new SQLReturnStatement();
58         if (expr !is null) {
59             x.setExpr(expr.clone());
60         }
61         return x;
62     }
63 
64     override
65     public List!SQLObject getChildren() {
66         return Collections.singletonList!SQLObject(this.expr);
67     }
68 }