1 | /* |
2 | |
3 | Derby - Class org.apache.derby.iapi.jdbc.BrokeredCallableStatement |
4 | |
5 | Copyright 2003, 2004 The Apache Software Foundation or its licensors, as applicable. |
6 | |
7 | Licensed under the Apache License, Version 2.0 (the "License"); |
8 | you may not use this file except in compliance with the License. |
9 | You may obtain a copy of the License at |
10 | |
11 | http://www.apache.org/licenses/LICENSE-2.0 |
12 | |
13 | Unless required by applicable law or agreed to in writing, software |
14 | distributed under the License is distributed on an "AS IS" BASIS, |
15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | See the License for the specific language governing permissions and |
17 | limitations under the License. |
18 | |
19 | */ |
20 | |
21 | package org.apache.derby.iapi.jdbc; |
22 | |
23 | import java.sql.*; |
24 | import java.math.BigDecimal; |
25 | |
26 | import java.util.Calendar; |
27 | import java.util.Map; |
28 | |
29 | |
30 | /** |
31 | JDBC 2 brokered CallableStatement |
32 | */ |
33 | public class BrokeredCallableStatement extends BrokeredPreparedStatement |
34 | implements CallableStatement |
35 | { |
36 | |
37 | public BrokeredCallableStatement(BrokeredStatementControl control, int jdbcLevel, String sql) throws SQLException { |
38 | super(control, jdbcLevel, sql); |
39 | } |
40 | |
41 | public final void registerOutParameter(int parameterIndex, |
42 | int sqlType) |
43 | throws SQLException |
44 | { |
45 | getCallableStatement().registerOutParameter( parameterIndex, sqlType); |
46 | } |
47 | |
48 | public final void registerOutParameter(int parameterIndex, |
49 | int sqlType, |
50 | int scale) |
51 | throws SQLException |
52 | { |
53 | getCallableStatement().registerOutParameter( parameterIndex, sqlType, scale); |
54 | } |
55 | |
56 | public final boolean wasNull() |
57 | throws SQLException |
58 | { |
59 | return getCallableStatement().wasNull(); |
60 | } |
61 | |
62 | public final String getString(int parameterIndex) |
63 | throws SQLException |
64 | { |
65 | return getCallableStatement().getString( parameterIndex); |
66 | } |
67 | |
68 | public final boolean getBoolean(int parameterIndex) |
69 | throws SQLException |
70 | { |
71 | return getCallableStatement().getBoolean( parameterIndex); |
72 | } |
73 | |
74 | public final byte getByte(int parameterIndex) |
75 | throws SQLException |
76 | { |
77 | return getCallableStatement().getByte( parameterIndex); |
78 | } |
79 | |
80 | public final short getShort(int parameterIndex) |
81 | throws SQLException |
82 | { |
83 | return getCallableStatement().getShort( parameterIndex); |
84 | } |
85 | |
86 | public final int getInt(int parameterIndex) |
87 | throws SQLException |
88 | { |
89 | return getCallableStatement().getInt( parameterIndex); |
90 | } |
91 | |
92 | public final long getLong(int parameterIndex) |
93 | throws SQLException |
94 | { |
95 | return getCallableStatement().getLong( parameterIndex); |
96 | } |
97 | |
98 | public final float getFloat(int parameterIndex) |
99 | throws SQLException |
100 | { |
101 | return getCallableStatement().getFloat( parameterIndex); |
102 | } |
103 | |
104 | public final double getDouble(int parameterIndex) |
105 | throws SQLException |
106 | { |
107 | return getCallableStatement().getDouble( parameterIndex); |
108 | } |
109 | |
110 | public final BigDecimal getBigDecimal(int parameterIndex, |
111 | int scale) |
112 | throws SQLException |
113 | { |
114 | return getCallableStatement().getBigDecimal( parameterIndex, scale); |
115 | } |
116 | |
117 | public final byte[] getBytes(int parameterIndex) |
118 | throws SQLException |
119 | { |
120 | return getCallableStatement().getBytes( parameterIndex); |
121 | } |
122 | |
123 | public final Date getDate(int parameterIndex) |
124 | throws SQLException |
125 | { |
126 | return getCallableStatement().getDate( parameterIndex); |
127 | } |
128 | |
129 | public final Date getDate(int parameterIndex, |
130 | Calendar cal) |
131 | throws SQLException |
132 | { |
133 | return getCallableStatement().getDate( parameterIndex, cal); |
134 | } |
135 | |
136 | public final Time getTime(int parameterIndex) |
137 | throws SQLException |
138 | { |
139 | return getCallableStatement().getTime( parameterIndex); |
140 | } |
141 | |
142 | public final Timestamp getTimestamp(int parameterIndex) |
143 | throws SQLException |
144 | { |
145 | return getCallableStatement().getTimestamp( parameterIndex); |
146 | } |
147 | |
148 | public final Object getObject(int parameterIndex) |
149 | throws SQLException |
150 | { |
151 | return getCallableStatement().getObject( parameterIndex); |
152 | } |
153 | |
154 | public final BigDecimal getBigDecimal(int parameterIndex) |
155 | throws SQLException |
156 | { |
157 | return getCallableStatement().getBigDecimal( parameterIndex); |
158 | } |
159 | |
160 | public final Object getObject(int i, |
161 | Map map) |
162 | throws SQLException |
163 | { |
164 | return getCallableStatement().getObject( i, map); |
165 | } |
166 | |
167 | public final Ref getRef(int i) |
168 | throws SQLException |
169 | { |
170 | return getCallableStatement().getRef( i); |
171 | } |
172 | |
173 | public final Blob getBlob(int i) |
174 | throws SQLException |
175 | { |
176 | return getCallableStatement().getBlob( i); |
177 | } |
178 | |
179 | public final Clob getClob(int i) |
180 | throws SQLException |
181 | { |
182 | return getCallableStatement().getClob( i); |
183 | } |
184 | |
185 | public final Array getArray(int i) |
186 | throws SQLException |
187 | { |
188 | return getCallableStatement().getArray( i); |
189 | } |
190 | |
191 | public final Time getTime(int parameterIndex, |
192 | Calendar cal) |
193 | throws SQLException |
194 | { |
195 | return getCallableStatement().getTime( parameterIndex, cal); |
196 | } |
197 | |
198 | public final Timestamp getTimestamp(int parameterIndex, |
199 | Calendar cal) |
200 | throws SQLException |
201 | { |
202 | return getCallableStatement().getTimestamp( parameterIndex, cal); |
203 | } |
204 | |
205 | public final void registerOutParameter(int paramIndex, |
206 | int sqlType, |
207 | String typeName) |
208 | throws SQLException |
209 | { |
210 | getCallableStatement().registerOutParameter( paramIndex, sqlType, typeName); |
211 | } |
212 | |
213 | /* |
214 | ** Control methods |
215 | */ |
216 | |
217 | /** |
218 | * Access the underlying CallableStatement. This method |
219 | * is package protected to restrict access to the underlying |
220 | * object to the brokered objects. Allowing the application to |
221 | * access the underlying object thtough a public method would |
222 | * |
223 | */ |
224 | final CallableStatement getCallableStatement() throws SQLException { |
225 | return control.getRealCallableStatement(); |
226 | } |
227 | |
228 | /** |
229 | * Access the underlying PreparedStatement. This method |
230 | * is package protected to restrict access to the underlying |
231 | * object to the brokered objects. Allowing the application to |
232 | * access the underlying object thtough a public method would |
233 | * |
234 | */ |
235 | final PreparedStatement getPreparedStatement() throws SQLException { |
236 | return getCallableStatement(); |
237 | } |
238 | /** |
239 | Create a duplicate CalableStatement to this, including state, from the passed in Connection. |
240 | */ |
241 | public CallableStatement createDuplicateStatement(Connection conn, CallableStatement oldStatement) throws SQLException { |
242 | |
243 | CallableStatement newStatement = conn.prepareCall(sql, resultSetType, resultSetConcurrency); |
244 | |
245 | setStatementState(oldStatement, newStatement); |
246 | |
247 | return newStatement; |
248 | } |
249 | } |