KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > jdbc > BrokeredCallableStatement40


1 /*
2  
3    Derby - Class org.apache.derby.iapi.jdbc.BrokeredCallableStatement40
4  
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11  
12       http://www.apache.org/licenses/LICENSE-2.0
13  
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19  
20  */

21
22 package org.apache.derby.iapi.jdbc;
23
24 import java.io.Reader JavaDoc;
25 import java.io.InputStream JavaDoc;
26 import java.sql.Blob JavaDoc;
27 import java.sql.Clob JavaDoc;
28 import java.sql.NClob JavaDoc;
29 import java.sql.RowId JavaDoc;
30 import java.sql.SQLException JavaDoc;
31 import java.sql.SQLXML JavaDoc;
32 import org.apache.derby.iapi.reference.SQLState;
33 import org.apache.derby.impl.jdbc.Util;
34
35 public class BrokeredCallableStatement40 extends BrokeredCallableStatement30{
36     
37     public BrokeredCallableStatement40(BrokeredStatementControl control, int jdbcLevel, String JavaDoc sql) throws SQLException JavaDoc{
38         super(control,jdbcLevel,sql);
39     }
40     
41     public Reader JavaDoc getCharacterStream(int parameterIndex)
42         throws SQLException JavaDoc {
43         return getCallableStatement().getCharacterStream(parameterIndex);
44     }
45     
46     public Reader JavaDoc getCharacterStream(String JavaDoc parameterName)
47         throws SQLException JavaDoc {
48         return getCallableStatement().getCharacterStream(parameterName);
49     }
50     
51     public Reader JavaDoc getNCharacterStream(int parameterIndex)
52         throws SQLException JavaDoc {
53         return getCallableStatement().getNCharacterStream(parameterIndex);
54     }
55     
56     public Reader JavaDoc getNCharacterStream(String JavaDoc parameterName)
57         throws SQLException JavaDoc {
58         return getCallableStatement().getNCharacterStream(parameterName);
59     }
60
61     public String JavaDoc getNString(int parameterIndex)
62         throws SQLException JavaDoc {
63         return getCallableStatement().getNString(parameterIndex);
64     }
65
66     public String JavaDoc getNString(String JavaDoc parameterName)
67         throws SQLException JavaDoc {
68         return getCallableStatement().getNString(parameterName);
69     }
70
71     public RowId JavaDoc getRowId(int parameterIndex) throws SQLException JavaDoc{
72         return getCallableStatement().getRowId(parameterIndex);
73     }
74     
75     public RowId JavaDoc getRowId(String JavaDoc parameterName) throws SQLException JavaDoc{
76         return getCallableStatement().getRowId(parameterName);
77     }
78     
79     public void setRowId(String JavaDoc parameterName, RowId JavaDoc x) throws SQLException JavaDoc{
80         getCallableStatement().setRowId(parameterName,x);
81     }
82     
83     public void setBlob(String JavaDoc parameterName, Blob JavaDoc x)
84         throws SQLException JavaDoc {
85         getCallableStatement().setBlob(parameterName, x);
86     }
87
88     public void setClob(String JavaDoc parameterName, Clob JavaDoc x)
89         throws SQLException JavaDoc {
90         getCallableStatement().setClob(parameterName, x);
91     }
92
93     public void setNString(String JavaDoc parameterName, String JavaDoc value)
94     throws SQLException JavaDoc{
95         getCallableStatement().setNString(parameterName,value);
96     }
97
98     public final void setNCharacterStream(String JavaDoc parameterName, Reader JavaDoc value)
99             throws SQLException JavaDoc {
100         getCallableStatement().setNCharacterStream(parameterName, value);
101     }
102
103     public void setNCharacterStream(String JavaDoc parameterName,Reader JavaDoc value,long length)
104     throws SQLException JavaDoc{
105         getCallableStatement().setNCharacterStream(parameterName,value,length);
106     }
107     
108     public void setNClob(String JavaDoc parameterName, NClob JavaDoc value) throws SQLException JavaDoc{
109         getCallableStatement().setNClob(parameterName,value);
110     }
111
112     public final void setClob(String JavaDoc parameterName, Reader JavaDoc reader)
113             throws SQLException JavaDoc {
114         getCallableStatement().setClob(parameterName, reader);
115     }
116
117     public void setClob(String JavaDoc parameterName, Reader JavaDoc reader, long length)
118     throws SQLException JavaDoc{
119         getCallableStatement().setClob(parameterName,reader,length);
120     }
121
122     public final void setBlob(String JavaDoc parameterName, InputStream JavaDoc inputStream)
123             throws SQLException JavaDoc {
124         getCallableStatement().setBlob(parameterName, inputStream);
125     }
126
127     public void setBlob(String JavaDoc parameterName, InputStream JavaDoc inputStream, long length)
128     throws SQLException JavaDoc{
129         getCallableStatement().setBlob(parameterName,inputStream,length);
130     }
131
132     public final void setNClob(String JavaDoc parameterName, Reader JavaDoc reader)
133             throws SQLException JavaDoc {
134         getCallableStatement().setNClob(parameterName, reader);
135     }
136
137     public void setNClob(String JavaDoc parameterName, Reader JavaDoc reader, long length)
138     throws SQLException JavaDoc{
139         getCallableStatement().setNClob(parameterName,reader,length);
140     }
141     
142     public NClob JavaDoc getNClob(int i) throws SQLException JavaDoc{
143         return getCallableStatement().getNClob(i);
144     }
145     
146     public NClob JavaDoc getNClob(String JavaDoc parameterName) throws SQLException JavaDoc{
147         return getCallableStatement().getNClob(parameterName);
148     }
149     
150     public void setSQLXML(String JavaDoc parameterName, SQLXML JavaDoc xmlObject) throws SQLException JavaDoc{
151         getCallableStatement().setSQLXML(parameterName,xmlObject);
152     }
153     
154     public SQLXML JavaDoc getSQLXML(int parameterIndex) throws SQLException JavaDoc{
155         return getCallableStatement().getSQLXML(parameterIndex);
156     }
157     
158     public SQLXML JavaDoc getSQLXML(String JavaDoc parametername) throws SQLException JavaDoc{
159         return getCallableStatement().getSQLXML(parametername);
160     }
161     
162     /************************************************************************
163      *PreparedStatement40 methods
164      *************************************************************************/

165
166     /**
167      * Sets the designated parameter to the given input stream.
168      *
169      * @param parameterIndex the first parameter is 1, the second is 2, ...
170      * @param x the Java input stream that contains the ASCII parameter value
171      * @throws SQLException if a database access error occurs or this method is
172      * called on a closed <code>PreparedStatement</code>
173      */

174     public final void setAsciiStream(int parameterIndex, InputStream JavaDoc x)
175             throws SQLException JavaDoc {
176         getCallableStatement().setAsciiStream(parameterIndex, x);
177     }
178
179     /**
180      * Sets the designated parameter to the given input stream.
181      *
182      * @param parameterIndex the first parameter is 1, the second is 2, ...
183      * @param x the java input stream which contains the binary parameter value
184      * @throws SQLException if a database access error occurs or this method is
185      * called on a closed <code>PreparedStatement</code>
186      */

187     public final void setBinaryStream(int parameterIndex, InputStream JavaDoc x)
188             throws SQLException JavaDoc {
189         getCallableStatement().setBinaryStream(parameterIndex, x);
190     }
191
192     /**
193      * Sets the designated parameter to the given <code>Reader</code> object.
194      *
195      * @param parameterIndex the first parameter is 1, the second is 2, ...
196      * @param reader the <code>java.io.Reader</code> object that contains the
197      * Unicode data
198      * @throws SQLException if a database access error occurs or this method is
199      * called on a closed <code>PreparedStatement</code>
200      */

201     public final void setCharacterStream(int parameterIndex, Reader JavaDoc reader)
202             throws SQLException JavaDoc {
203         getCallableStatement().setCharacterStream(parameterIndex, reader);
204     }
205
206     public void setRowId(int parameterIndex, RowId JavaDoc x) throws SQLException JavaDoc{
207         getPreparedStatement().setRowId(parameterIndex,x);
208     }
209     
210     public void setNString(int index, String JavaDoc value) throws SQLException JavaDoc{
211         getPreparedStatement().setNString(index,value);
212     }
213
214     public void setNCharacterStream(int parameterIndex, Reader JavaDoc value)
215             throws SQLException JavaDoc {
216         getCallableStatement().setNCharacterStream(parameterIndex, value);
217     }
218
219     public void setNCharacterStream(int index, Reader JavaDoc value, long length) throws SQLException JavaDoc{
220         getPreparedStatement().setNCharacterStream(index,value,length);
221     }
222     
223     public void setNClob(int index, NClob JavaDoc value) throws SQLException JavaDoc{
224         getPreparedStatement().setNClob(index,value);
225     }
226
227     /**
228      * Sets the designated parameter to a <code>Reader</code> object.
229      * This method differs from the <code>setCharacterStream(int,Reader)</code>
230      * method because it informs the driver that the parameter value should be
231      * sent to the server as a <code>CLOB</code>.
232      *
233      * @param parameterIndex the first parameter is 1, the second is 2, ...
234      * @param reader an object that contains the data to set the parameter
235      * value to.
236      * @throws SQLException if a database access error occurs, this method is
237      * called on a closed PreparedStatement
238      */

239     public final void setClob(int parameterIndex, Reader JavaDoc reader)
240             throws SQLException JavaDoc {
241         getCallableStatement().setClob(parameterIndex, reader);
242     }
243
244     public void setClob(int parameterIndex, Reader JavaDoc reader, long length)
245     throws SQLException JavaDoc{
246         getPreparedStatement().setClob(parameterIndex,reader,length);
247     }
248
249     /**
250      * Sets the designated parameter to a <code>InputStream</code> object.
251      * This method differs from the <code>setBinaryStream(int, InputStream)
252      * </code> method because it informs the driver that the parameter value
253      * should be sent to the server as a <code>BLOB</code>.
254      *
255      * @param inputStream an object that contains the data to set the parameter
256      * value to.
257      * @throws SQLException if a database access error occurs, this method is
258      * called on a closed <code>PreparedStatement</code>
259      */

260     public final void setBlob(int parameterIndex, InputStream JavaDoc inputStream)
261             throws SQLException JavaDoc {
262         getCallableStatement().setBlob(parameterIndex, inputStream);
263     }
264
265     public void setBlob(int parameterIndex, InputStream JavaDoc inputStream, long length)
266     throws SQLException JavaDoc{
267         getPreparedStatement().setBlob(parameterIndex,inputStream,length);
268     }
269
270     public final void setNClob(int parameterIndex, Reader JavaDoc reader)
271             throws SQLException JavaDoc {
272         getCallableStatement().setNClob(parameterIndex, reader);
273     }
274
275     public void setNClob(int parameterIndex, Reader JavaDoc reader, long length)
276     throws SQLException JavaDoc{
277         getPreparedStatement().setNClob(parameterIndex,reader,length);
278     }
279     
280     public void setSQLXML(int parameterIndex, SQLXML JavaDoc xmlObject) throws SQLException JavaDoc{
281         getPreparedStatement().setSQLXML(parameterIndex,xmlObject);
282     }
283     
284     /**
285      * Checks if the statement is closed.
286      *
287      * @return <code>true</code> if the statement is closed,
288      * <code>false</code> otherwise
289      * @exception SQLException if an error occurs
290      */

291     public final boolean isClosed() throws SQLException JavaDoc {
292         return getCallableStatement().isClosed();
293     }
294     
295     /**
296      * Returns <code>this</code> if this class implements the interface
297      *
298      * @param interfaces a Class defining an interface
299      * @return an object that implements the interface
300      * @throws java.sql.SQLExption if no object if found that implements the
301      * interface
302      */

303     public <T> T unwrap(java.lang.Class JavaDoc<T> interfaces)
304                             throws SQLException JavaDoc{
305         checkIfClosed();
306         //Derby does not implement non-standard methods on
307
//JDBC objects
308
try {
309             return interfaces.cast(this);
310         } catch (ClassCastException JavaDoc cce) {
311             throw Util.generateCsSQLException(SQLState.UNABLE_TO_UNWRAP,
312                     interfaces);
313         }
314     }
315     /**
316      * Forwards to the real CallableStatement.
317      * @return true if the underlying CallableStatement is poolable,
318      * false otherwise.
319      * @throws SQLException if the forwarding call fails.
320      */

321     public boolean isPoolable() throws SQLException JavaDoc {
322         return getStatement().isPoolable();
323     }
324
325     /**
326      * Forwards to the real CallableStatement.
327      * @param poolable new value for the poolable hint.
328      * @throws SQLException if the forwarding call fails.
329      */

330     public void setPoolable(boolean poolable) throws SQLException JavaDoc {
331         getStatement().setPoolable(poolable);
332     }
333
334     /**
335      * Sets the designated parameter to the given input stream, which will have
336      * the specified number of bytes.
337      *
338      * @param parameterIndex the first parameter is 1, the second is 2, ...
339      * @param x the java input stream which contains the ASCII parameter value
340      * @param length the number of bytes in the stream
341      * @exception SQLException thrown on failure.
342      *
343      */

344
345     public final void setAsciiStream(int parameterIndex, InputStream JavaDoc x, long length)
346     throws SQLException JavaDoc {
347         getCallableStatement().setAsciiStream(parameterIndex,x,length);
348     }
349
350     /**
351      * Sets the designated parameter to the given input stream, which will have
352      * the specified number of bytes.
353      *
354      * @param parameterIndex the first parameter is 1, the second is 2, ...
355      * @param x the java input stream which contains the binary parameter value
356      * @param length the number of bytes in the stream
357      * @exception SQLException thrown on failure.
358      *
359      */

360
361     public final void setBinaryStream(int parameterIndex, InputStream JavaDoc x, long length)
362     throws SQLException JavaDoc {
363         getCallableStatement().setBinaryStream(parameterIndex,x,length);
364     }
365
366     /**
367      * Sets the designated parameter to the given Reader, which will have
368      * the specified number of bytes.
369      *
370      * @param parameterIndex the first parameter is 1, the second is 2, ...
371      * @param x the java Reader which contains the UNICODE value
372      * @param length the number of bytes in the stream
373      * @exception SQLException thrown on failure.
374      *
375      */

376
377     public final void setCharacterStream(int parameterIndex, Reader JavaDoc x, long length)
378     throws SQLException JavaDoc {
379         getCallableStatement().setCharacterStream(parameterIndex,x,length);
380     }
381
382     public final void setAsciiStream(String JavaDoc parameterName, InputStream JavaDoc x)
383             throws SQLException JavaDoc {
384         getCallableStatement().setAsciiStream(parameterName, x);
385     }
386
387     /**
388      * Sets the designated parameter to the given input stream, which will have
389      * the specified number of bytes.
390      *
391      * @param parameterName the name of the parameter
392      * @param x the java input stream which contains the ASCII parameter value
393      * @param length the number of bytes in the stream
394      * @exception SQLException thrown on failure.
395      *
396      */

397
398     public final void setAsciiStream(String JavaDoc parameterName, InputStream JavaDoc x, long length)
399     throws SQLException JavaDoc {
400         getCallableStatement().setAsciiStream(parameterName,x,length);
401     }
402
403     public final void setBinaryStream(String JavaDoc parameterName, InputStream JavaDoc x)
404             throws SQLException JavaDoc {
405         getCallableStatement().setBinaryStream(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 binary 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 setBinaryStream(String JavaDoc parameterName, InputStream JavaDoc x, long length)
420     throws SQLException JavaDoc {
421         getCallableStatement().setBinaryStream(parameterName,x,length);
422     }
423
424     public final void setCharacterStream(String JavaDoc parameterName, Reader JavaDoc x)
425             throws SQLException JavaDoc {
426         getCallableStatement().setCharacterStream(parameterName, x);
427     }
428
429     /**
430      * Sets the designated parameter to the given Reader, which will have
431      * the specified number of bytes.
432      *
433      * @param parameterName the name of the parameter
434      * @param x the java Reader which contains the UNICODE value
435      * @param length the number of bytes in the stream
436      * @exception SQLException thrown on failure.
437      *
438      */

439
440     public final void setCharacterStream(String JavaDoc parameterName, Reader JavaDoc x, long length)
441     throws SQLException JavaDoc {
442         getCallableStatement().setCharacterStream(parameterName,x,length);
443     }
444 }
445
Popular Tags