1 /*
2  * Copyright (C) 2019, HuntLabs
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  */
17 
18 module hunt.database.driver.mysql.impl.codec.MySQLPreparedStatement;
19 
20 import hunt.database.driver.mysql.impl.codec.MySQLParamDesc;
21 import hunt.database.driver.mysql.impl.codec.MySQLRowDesc;
22 
23 import hunt.database.base.impl.ParamDesc;
24 import hunt.database.base.impl.PreparedStatement;
25 import hunt.database.base.impl.RowDesc;
26 
27 import hunt.collection.List;
28 import std.variant;
29 
30 
31 /**
32  * 
33  */
34 class MySQLPreparedStatement : PreparedStatement {
35 
36     long statementId;
37     string _sql;
38     MySQLParamDesc _paramDesc;
39     MySQLRowDesc _rowDesc;
40 
41     bool isCursorOpen;
42 
43     this(string sql, long statementId, MySQLParamDesc paramDesc, MySQLRowDesc rowDesc) {
44         this.statementId = statementId;
45         this._paramDesc = paramDesc;
46         this._rowDesc = rowDesc;
47         this._sql = sql;
48     }
49 
50     override
51     MySQLParamDesc paramDesc() {
52         return _paramDesc;
53     }
54 
55     override
56     MySQLRowDesc rowDesc() {
57         return _rowDesc;
58     }
59 
60     override
61     string sql() {
62         return _sql;
63     }
64 
65     override
66     string prepare(List!(Variant) values) {
67         return paramDesc.prepare(values);
68     }
69 }