001: /*
002:
003: Derby - Class org.apache.derby.iapi.jdbc.BrokeredCallableStatement40
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.io.Reader;
025: import java.io.InputStream;
026: import java.sql.Blob;
027: import java.sql.Clob;
028: import java.sql.NClob;
029: import java.sql.RowId;
030: import java.sql.SQLException;
031: import java.sql.SQLXML;
032: import org.apache.derby.iapi.reference.SQLState;
033: import org.apache.derby.impl.jdbc.Util;
034:
035: public class BrokeredCallableStatement40 extends
036: BrokeredCallableStatement30 {
037:
038: public BrokeredCallableStatement40(
039: BrokeredStatementControl control, int jdbcLevel, String sql)
040: throws SQLException {
041: super (control, jdbcLevel, sql);
042: }
043:
044: public Reader getCharacterStream(int parameterIndex)
045: throws SQLException {
046: return getCallableStatement()
047: .getCharacterStream(parameterIndex);
048: }
049:
050: public Reader getCharacterStream(String parameterName)
051: throws SQLException {
052: return getCallableStatement().getCharacterStream(parameterName);
053: }
054:
055: public Reader getNCharacterStream(int parameterIndex)
056: throws SQLException {
057: return getCallableStatement().getNCharacterStream(
058: parameterIndex);
059: }
060:
061: public Reader getNCharacterStream(String parameterName)
062: throws SQLException {
063: return getCallableStatement()
064: .getNCharacterStream(parameterName);
065: }
066:
067: public String getNString(int parameterIndex) throws SQLException {
068: return getCallableStatement().getNString(parameterIndex);
069: }
070:
071: public String getNString(String parameterName) throws SQLException {
072: return getCallableStatement().getNString(parameterName);
073: }
074:
075: public RowId getRowId(int parameterIndex) throws SQLException {
076: return getCallableStatement().getRowId(parameterIndex);
077: }
078:
079: public RowId getRowId(String parameterName) throws SQLException {
080: return getCallableStatement().getRowId(parameterName);
081: }
082:
083: public void setRowId(String parameterName, RowId x)
084: throws SQLException {
085: getCallableStatement().setRowId(parameterName, x);
086: }
087:
088: public void setBlob(String parameterName, Blob x)
089: throws SQLException {
090: getCallableStatement().setBlob(parameterName, x);
091: }
092:
093: public void setClob(String parameterName, Clob x)
094: throws SQLException {
095: getCallableStatement().setClob(parameterName, x);
096: }
097:
098: public void setNString(String parameterName, String value)
099: throws SQLException {
100: getCallableStatement().setNString(parameterName, value);
101: }
102:
103: public final void setNCharacterStream(String parameterName,
104: Reader value) throws SQLException {
105: getCallableStatement()
106: .setNCharacterStream(parameterName, value);
107: }
108:
109: public void setNCharacterStream(String parameterName, Reader value,
110: long length) throws SQLException {
111: getCallableStatement().setNCharacterStream(parameterName,
112: value, length);
113: }
114:
115: public void setNClob(String parameterName, NClob value)
116: throws SQLException {
117: getCallableStatement().setNClob(parameterName, value);
118: }
119:
120: public final void setClob(String parameterName, Reader reader)
121: throws SQLException {
122: getCallableStatement().setClob(parameterName, reader);
123: }
124:
125: public void setClob(String parameterName, Reader reader, long length)
126: throws SQLException {
127: getCallableStatement().setClob(parameterName, reader, length);
128: }
129:
130: public final void setBlob(String parameterName,
131: InputStream inputStream) throws SQLException {
132: getCallableStatement().setBlob(parameterName, inputStream);
133: }
134:
135: public void setBlob(String parameterName, InputStream inputStream,
136: long length) throws SQLException {
137: getCallableStatement().setBlob(parameterName, inputStream,
138: length);
139: }
140:
141: public final void setNClob(String parameterName, Reader reader)
142: throws SQLException {
143: getCallableStatement().setNClob(parameterName, reader);
144: }
145:
146: public void setNClob(String parameterName, Reader reader,
147: long length) throws SQLException {
148: getCallableStatement().setNClob(parameterName, reader, length);
149: }
150:
151: public NClob getNClob(int i) throws SQLException {
152: return getCallableStatement().getNClob(i);
153: }
154:
155: public NClob getNClob(String parameterName) throws SQLException {
156: return getCallableStatement().getNClob(parameterName);
157: }
158:
159: public void setSQLXML(String parameterName, SQLXML xmlObject)
160: throws SQLException {
161: getCallableStatement().setSQLXML(parameterName, xmlObject);
162: }
163:
164: public SQLXML getSQLXML(int parameterIndex) throws SQLException {
165: return getCallableStatement().getSQLXML(parameterIndex);
166: }
167:
168: public SQLXML getSQLXML(String parametername) throws SQLException {
169: return getCallableStatement().getSQLXML(parametername);
170: }
171:
172: /************************************************************************
173: *PreparedStatement40 methods
174: *************************************************************************/
175:
176: /**
177: * Sets the designated parameter to the given input stream.
178: *
179: * @param parameterIndex the first parameter is 1, the second is 2, ...
180: * @param x the Java input stream that contains the ASCII parameter value
181: * @throws SQLException if a database access error occurs or this method is
182: * called on a closed <code>PreparedStatement</code>
183: */
184: public final void setAsciiStream(int parameterIndex, InputStream x)
185: throws SQLException {
186: getCallableStatement().setAsciiStream(parameterIndex, x);
187: }
188:
189: /**
190: * Sets the designated parameter to the given input stream.
191: *
192: * @param parameterIndex the first parameter is 1, the second is 2, ...
193: * @param x the java input stream which contains the binary parameter value
194: * @throws SQLException if a database access error occurs or this method is
195: * called on a closed <code>PreparedStatement</code>
196: */
197: public final void setBinaryStream(int parameterIndex, InputStream x)
198: throws SQLException {
199: getCallableStatement().setBinaryStream(parameterIndex, x);
200: }
201:
202: /**
203: * Sets the designated parameter to the given <code>Reader</code> object.
204: *
205: * @param parameterIndex the first parameter is 1, the second is 2, ...
206: * @param reader the <code>java.io.Reader</code> object that contains the
207: * Unicode data
208: * @throws SQLException if a database access error occurs or this method is
209: * called on a closed <code>PreparedStatement</code>
210: */
211: public final void setCharacterStream(int parameterIndex,
212: Reader reader) throws SQLException {
213: getCallableStatement().setCharacterStream(parameterIndex,
214: reader);
215: }
216:
217: public void setRowId(int parameterIndex, RowId x)
218: throws SQLException {
219: getPreparedStatement().setRowId(parameterIndex, x);
220: }
221:
222: public void setNString(int index, String value) throws SQLException {
223: getPreparedStatement().setNString(index, value);
224: }
225:
226: public void setNCharacterStream(int parameterIndex, Reader value)
227: throws SQLException {
228: getCallableStatement().setNCharacterStream(parameterIndex,
229: value);
230: }
231:
232: public void setNCharacterStream(int index, Reader value, long length)
233: throws SQLException {
234: getPreparedStatement()
235: .setNCharacterStream(index, value, length);
236: }
237:
238: public void setNClob(int index, NClob value) throws SQLException {
239: getPreparedStatement().setNClob(index, value);
240: }
241:
242: /**
243: * Sets the designated parameter to a <code>Reader</code> object.
244: * This method differs from the <code>setCharacterStream(int,Reader)</code>
245: * method because it informs the driver that the parameter value should be
246: * sent to the server as a <code>CLOB</code>.
247: *
248: * @param parameterIndex the first parameter is 1, the second is 2, ...
249: * @param reader an object that contains the data to set the parameter
250: * value to.
251: * @throws SQLException if a database access error occurs, this method is
252: * called on a closed PreparedStatement
253: */
254: public final void setClob(int parameterIndex, Reader reader)
255: throws SQLException {
256: getCallableStatement().setClob(parameterIndex, reader);
257: }
258:
259: public void setClob(int parameterIndex, Reader reader, long length)
260: throws SQLException {
261: getPreparedStatement().setClob(parameterIndex, reader, length);
262: }
263:
264: /**
265: * Sets the designated parameter to a <code>InputStream</code> object.
266: * This method differs from the <code>setBinaryStream(int, InputStream)
267: * </code> method because it informs the driver that the parameter value
268: * should be sent to the server as a <code>BLOB</code>.
269: *
270: * @param inputStream an object that contains the data to set the parameter
271: * value to.
272: * @throws SQLException if a database access error occurs, this method is
273: * called on a closed <code>PreparedStatement</code>
274: */
275: public final void setBlob(int parameterIndex,
276: InputStream inputStream) throws SQLException {
277: getCallableStatement().setBlob(parameterIndex, inputStream);
278: }
279:
280: public void setBlob(int parameterIndex, InputStream inputStream,
281: long length) throws SQLException {
282: getPreparedStatement().setBlob(parameterIndex, inputStream,
283: length);
284: }
285:
286: public final void setNClob(int parameterIndex, Reader reader)
287: throws SQLException {
288: getCallableStatement().setNClob(parameterIndex, reader);
289: }
290:
291: public void setNClob(int parameterIndex, Reader reader, long length)
292: throws SQLException {
293: getPreparedStatement().setNClob(parameterIndex, reader, length);
294: }
295:
296: public void setSQLXML(int parameterIndex, SQLXML xmlObject)
297: throws SQLException {
298: getPreparedStatement().setSQLXML(parameterIndex, xmlObject);
299: }
300:
301: /**
302: * Checks if the statement is closed.
303: *
304: * @return <code>true</code> if the statement is closed,
305: * <code>false</code> otherwise
306: * @exception SQLException if an error occurs
307: */
308: public final boolean isClosed() throws SQLException {
309: return getCallableStatement().isClosed();
310: }
311:
312: /**
313: * Returns <code>this</code> if this class implements the interface
314: *
315: * @param interfaces a Class defining an interface
316: * @return an object that implements the interface
317: * @throws java.sql.SQLExption if no object if found that implements the
318: * interface
319: */
320: public <T> T unwrap(java.lang.Class<T> interfaces)
321: throws SQLException {
322: checkIfClosed();
323: //Derby does not implement non-standard methods on
324: //JDBC objects
325: try {
326: return interfaces.cast(this );
327: } catch (ClassCastException cce) {
328: throw Util.generateCsSQLException(
329: SQLState.UNABLE_TO_UNWRAP, interfaces);
330: }
331: }
332:
333: /**
334: * Forwards to the real CallableStatement.
335: * @return true if the underlying CallableStatement is poolable,
336: * false otherwise.
337: * @throws SQLException if the forwarding call fails.
338: */
339: public boolean isPoolable() throws SQLException {
340: return getStatement().isPoolable();
341: }
342:
343: /**
344: * Forwards to the real CallableStatement.
345: * @param poolable new value for the poolable hint.
346: * @throws SQLException if the forwarding call fails.
347: */
348: public void setPoolable(boolean poolable) throws SQLException {
349: getStatement().setPoolable(poolable);
350: }
351:
352: /**
353: * Sets the designated parameter to the given input stream, which will have
354: * the specified number of bytes.
355: *
356: * @param parameterIndex the first parameter is 1, the second is 2, ...
357: * @param x the java input stream which contains the ASCII parameter value
358: * @param length the number of bytes in the stream
359: * @exception SQLException thrown on failure.
360: *
361: */
362:
363: public final void setAsciiStream(int parameterIndex, InputStream x,
364: long length) throws SQLException {
365: getCallableStatement()
366: .setAsciiStream(parameterIndex, x, length);
367: }
368:
369: /**
370: * Sets the designated parameter to the given input stream, which will have
371: * the specified number of bytes.
372: *
373: * @param parameterIndex the first parameter is 1, the second is 2, ...
374: * @param x the java input stream which contains the binary parameter value
375: * @param length the number of bytes in the stream
376: * @exception SQLException thrown on failure.
377: *
378: */
379:
380: public final void setBinaryStream(int parameterIndex,
381: InputStream x, long length) throws SQLException {
382: getCallableStatement().setBinaryStream(parameterIndex, x,
383: length);
384: }
385:
386: /**
387: * Sets the designated parameter to the given Reader, which will have
388: * the specified number of bytes.
389: *
390: * @param parameterIndex the first parameter is 1, the second is 2, ...
391: * @param x the java Reader which contains the UNICODE value
392: * @param length the number of bytes in the stream
393: * @exception SQLException thrown on failure.
394: *
395: */
396:
397: public final void setCharacterStream(int parameterIndex, Reader x,
398: long length) throws SQLException {
399: getCallableStatement().setCharacterStream(parameterIndex, x,
400: length);
401: }
402:
403: public final void setAsciiStream(String parameterName, InputStream x)
404: throws SQLException {
405: getCallableStatement().setAsciiStream(parameterName, x);
406: }
407:
408: /**
409: * Sets the designated parameter to the given input stream, which will have
410: * the specified number of bytes.
411: *
412: * @param parameterName the name of the parameter
413: * @param x the java input stream which contains the ASCII parameter value
414: * @param length the number of bytes in the stream
415: * @exception SQLException thrown on failure.
416: *
417: */
418:
419: public final void setAsciiStream(String parameterName,
420: InputStream x, long length) throws SQLException {
421: getCallableStatement().setAsciiStream(parameterName, x, length);
422: }
423:
424: public final void setBinaryStream(String parameterName,
425: InputStream x) throws SQLException {
426: getCallableStatement().setBinaryStream(parameterName, x);
427: }
428:
429: /**
430: * Sets the designated parameter to the given input stream, which will have
431: * the specified number of bytes.
432: *
433: * @param parameterName the name of the parameter
434: * @param x the java input stream which contains the binary parameter value
435: * @param length the number of bytes in the stream
436: * @exception SQLException thrown on failure.
437: *
438: */
439:
440: public final void setBinaryStream(String parameterName,
441: InputStream x, long length) throws SQLException {
442: getCallableStatement()
443: .setBinaryStream(parameterName, x, length);
444: }
445:
446: public final void setCharacterStream(String parameterName, Reader x)
447: throws SQLException {
448: getCallableStatement().setCharacterStream(parameterName, x);
449: }
450:
451: /**
452: * Sets the designated parameter to the given Reader, which will have
453: * the specified number of bytes.
454: *
455: * @param parameterName the name of the parameter
456: * @param x the java Reader which contains the UNICODE value
457: * @param length the number of bytes in the stream
458: * @exception SQLException thrown on failure.
459: *
460: */
461:
462: public final void setCharacterStream(String parameterName,
463: Reader x, long length) throws SQLException {
464: getCallableStatement().setCharacterStream(parameterName, x,
465: length);
466: }
467: }
|