KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > jdbc > core > namedparam > ParsedSql


1 /*
2  * Copyright 2002-2006 the original author or authors.
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 package org.springframework.jdbc.core.namedparam;
18
19 /**
20  * Holds information for parsed SQL statements.
21  *
22  * @author Thomas Risberg
23  * @since 2.0
24  */

25 class ParsedSql {
26
27     private String JavaDoc sql;
28
29     private String JavaDoc newSql;
30
31     private String JavaDoc[] parameterNames;
32
33     private int namedParameterCount;
34
35     private int unnamedParameterCount;
36
37     private int totalParameterCount;
38
39
40     /**
41      * Creates a new instance of the {@link ParsedSql} class.
42      */

43     public ParsedSql() {
44     }
45
46     /**
47      * Creates a new instance of the {@link ParsedSql} class.
48      * @param sql the SQL statement that is being (or is to be) parsed
49      */

50     public ParsedSql(String JavaDoc sql) {
51         this.sql = sql;
52     }
53
54
55     /**
56      * Set the SQL statement that is being (or is to be) parsed.
57      */

58     public void setSql(String JavaDoc sql) {
59         this.sql = sql;
60     }
61
62     /**
63      * Get the SQL statement that is being (or is to be) parsed.
64      */

65     public String JavaDoc getSql() {
66         return sql;
67     }
68
69     /**
70      * Set the new (parsed) SQL.
71      */

72     public void setNewSql(String JavaDoc newSql) {
73         this.newSql = newSql;
74     }
75
76     /**
77      * Get the new (parsed) SQL.
78      */

79     public String JavaDoc getNewSql() {
80         return newSql;
81     }
82
83     /**
84      * Set the parameters (bind variables) in the parsed SQL statement.
85      * Repeated occurences of the same parameter name are included here.
86      */

87     public void setParameterNames(String JavaDoc[] parameterNames) {
88         this.parameterNames = parameterNames;
89     }
90
91     /**
92      * Get all of the parameters (bind variables) in the parsed SQL statement.
93      * Repeated occurences of the same parameter name are included here.
94      */

95     public String JavaDoc[] getParameterNames() {
96         return parameterNames;
97     }
98
99     /**
100      * Set the count of named parameters in the SQL statement.
101      * Each parameter name counts once; repeated occurences do not count here.
102      */

103     public void setNamedParameterCount(int namedParameterCount) {
104         this.namedParameterCount = namedParameterCount;
105     }
106
107     /**
108      * Get the count of named parameters in the SQL statement.
109      * Each parameter name counts once; repeated occurences do not count here.
110      */

111     public int getNamedParameterCount() {
112         return namedParameterCount;
113     }
114
115     /**
116      * Set the count of all of the unnamed parameters in the SQL statement.
117      */

118     public void setUnnamedParameterCount(int unnamedParameterCount) {
119         this.unnamedParameterCount = unnamedParameterCount;
120     }
121
122     /**
123      * Gets the count of all of the unnamed parameters in the SQL statement.
124      */

125     public int getUnnamedParameterCount() {
126         return unnamedParameterCount;
127     }
128
129     /**
130      * Set the total count of all of the parameters in the SQL statement.
131      * Repeated occurences of the same parameter name do count here.
132      */

133     public void setTotalParameterCount(int totalParameterCount) {
134         this.totalParameterCount = totalParameterCount;
135     }
136
137     /**
138      * Get the total count of all of the parameters in the SQL statement.
139      * Repeated occurences of the same parameter name do count here.
140      */

141     public int getTotalParameterCount() {
142         return totalParameterCount;
143     }
144
145 }
146
Popular Tags