| |||||||||||||||||
Source File | Conditionals | Statements | Methods | TOTAL | |||||||||||||
Configuration\Sql\Static\StaticSql.cs | - | 100.0 % | 100.0 % | 100.0 % |
|
1 | ||
2 | #region Apache Notice | |
3 | /***************************************************************************** | |
4 | * $Header: $ | |
5 | * $Revision: $ | |
6 | * $Date: $ | |
7 | * | |
8 | * iBATIS.NET Data Mapper | |
9 | * Copyright (C) 2004 - Gilles Bayon | |
10 | * | |
11 | * | |
12 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
13 | * you may not use this file except in compliance with the License. | |
14 | * You may obtain a copy of the License at | |
15 | * | |
16 | * http://www.apache.org/licenses/LICENSE-2.0 | |
17 | * | |
18 | * Unless required by applicable law or agreed to in writing, software | |
19 | * distributed under the License is distributed on an "AS IS" BASIS, | |
20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
21 | * See the License for the specific language governing permissions and | |
22 | * limitations under the License. | |
23 | * | |
24 | ********************************************************************************/ | |
25 | #endregion | |
26 | ||
27 | #region Imports | |
28 | using System; | |
29 | ||
30 | using IBatisNet.Common; | |
31 | using IBatisNet.DataMapper.Configuration.Statements; | |
32 | using IBatisNet.DataMapper.Scope; | |
33 | #endregion | |
34 | ||
35 | namespace IBatisNet.DataMapper.Configuration.Sql.Static | |
36 | { | |
37 | /// <summary> | |
38 | /// Summary description for StaticSql. | |
39 | /// </summary> | |
40 | public class StaticSql : ISql | |
41 | { | |
42 | ||
43 | #region Fields | |
44 | ||
45 | private IStatement _statement = null ; | |
46 | private PreparedStatement _preparedStatement = null ; | |
47 | ||
48 | #endregion | |
49 | ||
50 | #region Constructor (s) / Destructor | |
51 | /// <summary> | |
52 | /// Constructor | |
53 | /// </summary> | |
54 | /// <param name="statement">The statement.</param> | |
55 | 20400 | public StaticSql(IStatement statement) |
56 | { | |
57 | 20400 | _statement = statement; |
58 | } | |
59 | #endregion | |
60 | ||
61 | #region ISql Members | |
62 | ||
63 | ||
64 | /// <summary> | |
65 | /// Get the sql command text to execute. | |
66 | /// </summary> | |
67 | /// <param name="parameterObject">The parameter object (used in DynamicSql)</param> | |
68 | /// <param name="session"></param> | |
69 | /// <returns>The sql command text.</returns> | |
70 | 248 | public RequestScope GetRequestScope(object parameterObject, IDalSession session) |
71 | { | |
72 | 248 | RequestScope request = new RequestScope(); |
73 | ||
74 | 248 | request.ParameterMap = _statement.ParameterMap; |
75 | 248 | request.ResultMap = _statement.ResultMap; |
76 | 248 | request.PreparedStatement = _preparedStatement; |
77 | ||
78 | 248 | return request; |
79 | } | |
80 | ||
81 | /// <summary> | |
82 | /// Build the PreparedStatement | |
83 | /// </summary> | |
84 | /// <param name="session"></param> | |
85 | /// <param name="sqlStatement"></param> | |
86 | 20400 | public void BuildPreparedStatement(IDalSession session, string sqlStatement) |
87 | { | |
88 | 20400 | RequestScope request = new RequestScope(); |
89 | ||
90 | 20400 | request.ParameterMap = _statement.ParameterMap; |
91 | ||
92 | 20400 | PreparedStatementFactory factory = new PreparedStatementFactory( session, request, _statement, sqlStatement); |
93 | 20400 | _preparedStatement = factory.Prepare(); |
94 | } | |
95 | ||
96 | #endregion | |
97 | } | |
98 | } | |
99 |
|