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.SQLCloseStatement;
17 
18 import hunt.sql.ast.SQLName;
19 import hunt.sql.ast.SQLObject;
20 import hunt.sql.ast.SQLStatementImpl;
21 import hunt.sql.ast.expr.SQLIdentifierExpr;
22 import hunt.sql.visitor.SQLASTVisitor;
23 
24 import hunt.collection;
25 
26 /**
27  * 
28  * MySql cursor close statement
29  */
30 public class SQLCloseStatement : SQLStatementImpl{
31 	
32 	//cursor name
33 	private SQLName cursorName;
34 	
35 	public SQLName getCursorName() {
36 		return cursorName;
37 	}
38 
39 	public void setCursorName(string cursorName) {
40 		setCursorName(new SQLIdentifierExpr(cursorName));
41 	}
42 	
43 	public void setCursorName(SQLName cursorName) {
44 		if (cursorName !is null) {
45 			cursorName.setParent(this);
46 		}
47 		this.cursorName = cursorName;
48 	}
49 
50 	
51 	override  protected void accept0(SQLASTVisitor visitor) {
52 		if (visitor.visit(this)) {
53 			acceptChild(visitor, cursorName);
54 		}
55 	    visitor.endVisit(this);
56 		
57 	}
58 
59 	override
60 	public List!SQLObject getChildren() {
61 		// return Collections.emptyList!(SQLObject)();
62         List!SQLObject ls = new ArrayList!SQLObject();
63 		return ls;
64 	}
65 }