001: /*
002:
003: Derby - Class org.apache.derby.iapi.jdbc.BrokeredCallableStatement
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to you under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.iapi.jdbc;
023:
024: import java.sql.*;
025: import java.math.BigDecimal;
026:
027: import java.util.Calendar;
028: import java.util.Map;
029:
030: /**
031: JDBC 2 brokered CallableStatement
032: */
033: public class BrokeredCallableStatement extends
034: BrokeredPreparedStatement implements CallableStatement {
035:
036: public BrokeredCallableStatement(BrokeredStatementControl control,
037: int jdbcLevel, String sql) throws SQLException {
038: super (control, jdbcLevel, sql);
039: }
040:
041: public final void registerOutParameter(int parameterIndex,
042: int sqlType) throws SQLException {
043: getCallableStatement().registerOutParameter(parameterIndex,
044: sqlType);
045: }
046:
047: public final void registerOutParameter(int parameterIndex,
048: int sqlType, int scale) throws SQLException {
049: getCallableStatement().registerOutParameter(parameterIndex,
050: sqlType, scale);
051: }
052:
053: public final boolean wasNull() throws SQLException {
054: return getCallableStatement().wasNull();
055: }
056:
057: public final String getString(int parameterIndex)
058: throws SQLException {
059: return getCallableStatement().getString(parameterIndex);
060: }
061:
062: public final boolean getBoolean(int parameterIndex)
063: throws SQLException {
064: return getCallableStatement().getBoolean(parameterIndex);
065: }
066:
067: public final byte getByte(int parameterIndex) throws SQLException {
068: return getCallableStatement().getByte(parameterIndex);
069: }
070:
071: public final short getShort(int parameterIndex) throws SQLException {
072: return getCallableStatement().getShort(parameterIndex);
073: }
074:
075: public final int getInt(int parameterIndex) throws SQLException {
076: return getCallableStatement().getInt(parameterIndex);
077: }
078:
079: public final long getLong(int parameterIndex) throws SQLException {
080: return getCallableStatement().getLong(parameterIndex);
081: }
082:
083: public final float getFloat(int parameterIndex) throws SQLException {
084: return getCallableStatement().getFloat(parameterIndex);
085: }
086:
087: public final double getDouble(int parameterIndex)
088: throws SQLException {
089: return getCallableStatement().getDouble(parameterIndex);
090: }
091:
092: public final BigDecimal getBigDecimal(int parameterIndex, int scale)
093: throws SQLException {
094: return getCallableStatement().getBigDecimal(parameterIndex,
095: scale);
096: }
097:
098: public final byte[] getBytes(int parameterIndex)
099: throws SQLException {
100: return getCallableStatement().getBytes(parameterIndex);
101: }
102:
103: public final Date getDate(int parameterIndex) throws SQLException {
104: return getCallableStatement().getDate(parameterIndex);
105: }
106:
107: public final Date getDate(int parameterIndex, Calendar cal)
108: throws SQLException {
109: return getCallableStatement().getDate(parameterIndex, cal);
110: }
111:
112: public final Time getTime(int parameterIndex) throws SQLException {
113: return getCallableStatement().getTime(parameterIndex);
114: }
115:
116: public final Timestamp getTimestamp(int parameterIndex)
117: throws SQLException {
118: return getCallableStatement().getTimestamp(parameterIndex);
119: }
120:
121: public final Object getObject(int parameterIndex)
122: throws SQLException {
123: return getCallableStatement().getObject(parameterIndex);
124: }
125:
126: public final BigDecimal getBigDecimal(int parameterIndex)
127: throws SQLException {
128: return getCallableStatement().getBigDecimal(parameterIndex);
129: }
130:
131: public final Object getObject(int i, Map map) throws SQLException {
132: return getCallableStatement().getObject(i, map);
133: }
134:
135: public final Ref getRef(int i) throws SQLException {
136: return getCallableStatement().getRef(i);
137: }
138:
139: public final Blob getBlob(int i) throws SQLException {
140: return getCallableStatement().getBlob(i);
141: }
142:
143: public final Clob getClob(int i) throws SQLException {
144: return getCallableStatement().getClob(i);
145: }
146:
147: public final Array getArray(int i) throws SQLException {
148: return getCallableStatement().getArray(i);
149: }
150:
151: public final Time getTime(int parameterIndex, Calendar cal)
152: throws SQLException {
153: return getCallableStatement().getTime(parameterIndex, cal);
154: }
155:
156: public final Timestamp getTimestamp(int parameterIndex, Calendar cal)
157: throws SQLException {
158: return getCallableStatement().getTimestamp(parameterIndex, cal);
159: }
160:
161: public final void registerOutParameter(int paramIndex, int sqlType,
162: String typeName) throws SQLException {
163: getCallableStatement().registerOutParameter(paramIndex,
164: sqlType, typeName);
165: }
166:
167: /*
168: ** Control methods
169: */
170:
171: /**
172: * Access the underlying CallableStatement. This method
173: * is package protected to restrict access to the underlying
174: * object to the brokered objects. Allowing the application to
175: * access the underlying object thtough a public method would
176: *
177: */
178: final CallableStatement getCallableStatement() throws SQLException {
179: return control.getRealCallableStatement();
180: }
181:
182: /**
183: * Access the underlying PreparedStatement. This method
184: * is package protected to restrict access to the underlying
185: * object to the brokered objects. Allowing the application to
186: * access the underlying object thtough a public method would
187: *
188: */
189: final PreparedStatement getPreparedStatement() throws SQLException {
190: return getCallableStatement();
191: }
192:
193: /**
194: Create a duplicate CalableStatement to this, including state, from the passed in Connection.
195: */
196: public CallableStatement createDuplicateStatement(Connection conn,
197: CallableStatement oldStatement) throws SQLException {
198:
199: CallableStatement newStatement = conn.prepareCall(sql,
200: resultSetType, resultSetConcurrency);
201:
202: setStatementState(oldStatement, newStatement);
203:
204: return newStatement;
205: }
206: }
|