KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  
3    Derby - Class org.apache.derby.iapi.jdbc.BrokeredPreparedStatement40
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.InputStream JavaDoc;
25 import java.io.Reader JavaDoc;
26 import java.sql.NClob JavaDoc;
27 import java.sql.RowId JavaDoc;
28 import java.sql.SQLException JavaDoc;
29 import java.sql.SQLXML JavaDoc;
30 import org.apache.derby.impl.jdbc.Util;
31 import org.apache.derby.iapi.reference.SQLState;
32
33 public class BrokeredPreparedStatement40 extends BrokeredPreparedStatement30{
34     
35     public BrokeredPreparedStatement40(BrokeredStatementControl control, int jdbcLevel, String JavaDoc sql, Object JavaDoc generatedKeys) throws SQLException JavaDoc {
36         super(control, jdbcLevel, sql,generatedKeys);
37     }
38     
39     public void setRowId(int parameterIndex, RowId JavaDoc x) throws SQLException JavaDoc{
40         getPreparedStatement().setRowId (parameterIndex, x);
41     }
42     
43     public void setNString(int index, String JavaDoc value) throws SQLException JavaDoc{
44         getPreparedStatement().setNString (index, value);
45     }
46     
47     public void setNCharacterStream(int parameterIndex, Reader JavaDoc value)
48             throws SQLException JavaDoc {
49         getPreparedStatement().setNCharacterStream(parameterIndex, value);
50     }
51
52     public void setNCharacterStream(int index, Reader JavaDoc value, long length) throws SQLException JavaDoc{
53         getPreparedStatement().setNCharacterStream (index, value, length);
54     }
55     
56     public void setNClob(int index, NClob JavaDoc value) throws SQLException JavaDoc{
57         getPreparedStatement().setNClob (index, value);
58     }
59     
60     public void setClob(int parameterIndex, Reader JavaDoc reader, long length)
61     throws SQLException JavaDoc{
62         getPreparedStatement().setClob (parameterIndex, reader, length);
63     }
64     
65     public void setBlob(int parameterIndex, InputStream JavaDoc inputStream, long length)
66     throws SQLException JavaDoc{
67         getPreparedStatement().setBlob (parameterIndex, inputStream, length);
68     }
69
70     public final void setNClob(int parameterIndex, Reader JavaDoc reader)
71             throws SQLException JavaDoc {
72         getPreparedStatement().setNClob(parameterIndex, reader);
73     }
74
75     public void setNClob(int parameterIndex, Reader JavaDoc reader, long length)
76     throws SQLException JavaDoc{
77         getPreparedStatement().setNClob (parameterIndex, reader, length);
78     }
79     
80     public void setSQLXML(int parameterIndex, SQLXML JavaDoc xmlObject) throws SQLException JavaDoc{
81         getPreparedStatement().setSQLXML (parameterIndex, xmlObject);
82     }
83     
84     /**
85      * Checks if the statement is closed.
86      *
87      * @return <code>true</code> if the statement is closed,
88      * <code>false</code> otherwise
89      * @exception SQLException if an error occurs
90      */

91     public final boolean isClosed() throws SQLException JavaDoc {
92         return getPreparedStatement().isClosed();
93     }
94     
95     /**
96      * Returns <code>this</code> if this class implements the interface
97      *
98      * @param interfaces a Class defining an interface
99      * @return an object that implements the interface
100      * @throws java.sql.SQLExption if no object if found that implements the
101      * interface
102      */

103     public <T> T unwrap(java.lang.Class JavaDoc<T> interfaces)
104                             throws SQLException JavaDoc{
105         checkIfClosed();
106         //Derby does not implement non-standard methods on
107
//JDBC objects
108
try {
109             return interfaces.cast(this);
110         } catch (ClassCastException JavaDoc cce) {
111             throw Util.generateCsSQLException(SQLState.UNABLE_TO_UNWRAP,
112                     interfaces);
113         }
114     }
115
116     /**
117      * Forwards to the real PreparedStatement.
118      * @return true if the underlying PreparedStatement is poolable,
119      * false otherwise.
120      * @throws SQLException if the forwarding call fails.
121      */

122     public boolean isPoolable() throws SQLException JavaDoc {
123         return getStatement().isPoolable();
124     }
125
126     /**
127      * Forwards to the real PreparedStatement.
128      * @param poolable the new value for the poolable hint.
129      * @throws SQLException if the forwarding call fails.
130      */

131     public void setPoolable(boolean poolable) throws SQLException JavaDoc {
132         getStatement().setPoolable(poolable);
133     }
134
135     /**
136      * Sets the designated parameter to the given input stream.
137      *
138      * @param parameterIndex the first parameter is 1, the second is 2, ...
139      * @param x the Java input stream that contains the ASCII parameter value
140      * @throws SQLException if a database access error occurs or this method is
141      * called on a closed <code>PreparedStatement</code>
142      */

143     public final void setAsciiStream(int parameterIndex, InputStream JavaDoc x)
144             throws SQLException JavaDoc {
145         getPreparedStatement().setAsciiStream(parameterIndex, x);
146     }
147
148     /**
149      * Sets the designated parameter to the given input stream, which will have
150      * the specified number of bytes.
151      *
152      * @param parameterIndex the first parameter is 1, the second is 2, ...
153      * @param x the java input stream which contains the ASCII parameter value
154      * @param length the number of bytes in the stream
155      * @exception SQLException thrown on failure.
156      *
157      */

158
159     public final void setAsciiStream(int parameterIndex, InputStream JavaDoc x, long length)
160     throws SQLException JavaDoc {
161         getPreparedStatement().setAsciiStream(parameterIndex,x,length);
162     }
163
164     /**
165      * Sets the designated parameter to the given input stream.
166      *
167      * @param parameterIndex the first parameter is 1, the second is 2, ...
168      * @param x the java input stream which contains the binary parameter value
169      * @throws SQLException if a database access error occurs or this method is
170      * called on a closed <code>PreparedStatement</code>
171      */

172     public final void setBinaryStream(int parameterIndex, InputStream JavaDoc x)
173             throws SQLException JavaDoc {
174         getPreparedStatement().setBinaryStream(parameterIndex, x);
175     }
176
177     /**
178      * Sets the designated parameter to the given input stream, which will have
179      * the specified number of bytes.
180      *
181      * @param parameterIndex the first parameter is 1, the second is 2, ...
182      * @param x the java input stream which contains the binary parameter value
183      * @param length the number of bytes in the stream
184      * @exception SQLException thrown on failure.
185      *
186      */

187
188     public final void setBinaryStream(int parameterIndex, InputStream JavaDoc x, long length)
189     throws SQLException JavaDoc {
190         getPreparedStatement().setBinaryStream(parameterIndex,x,length);
191     }
192
193     /**
194      * Sets the designated parameter to a <code>InputStream</code> object.
195      * This method differs from the <code>setBinaryStream(int, InputStream)
196      * </code> method because it informs the driver that the parameter value
197      * should be sent to the server as a <code>BLOB</code>.
198      *
199      * @param inputStream an object that contains the data to set the parameter
200      * value to.
201      * @throws SQLException if a database access error occurs, this method is
202      * called on a closed <code>PreparedStatement</code>
203      */

204     public final void setBlob(int parameterIndex, InputStream JavaDoc inputStream)
205             throws SQLException JavaDoc {
206         getPreparedStatement().setBlob(parameterIndex, inputStream);
207     }
208
209     /**
210      * Sets the designated parameter to the given <code>Reader</code> object.
211      *
212      * @param parameterIndex the first parameter is 1, the second is 2, ...
213      * @param reader the <code>java.io.Reader</code> object that contains the
214      * Unicode data
215      * @throws SQLException if a database access error occurs or this method is
216      * called on a closed <code>PreparedStatement</code>
217      */

218     public final void setCharacterStream(int parameterIndex, Reader JavaDoc reader)
219             throws SQLException JavaDoc {
220         getPreparedStatement().setCharacterStream(parameterIndex, reader);
221     }
222
223     /**
224      * Sets the designated parameter to the given Reader, which will have
225      * the specified number of bytes.
226      *
227      * @param parameterIndex the first parameter is 1, the second is 2, ...
228      * @param x the java Reader which contains the UNICODE value
229      * @param length the number of bytes in the stream
230      * @exception SQLException thrown on failure.
231      *
232      */

233
234     public final void setCharacterStream(int parameterIndex, Reader JavaDoc x, long length)
235     throws SQLException JavaDoc {
236         getPreparedStatement().setCharacterStream(parameterIndex,x,length);
237     }
238
239     /**
240      * Sets the designated parameter to a <code>Reader</code> object.
241      * This method differs from the <code>setCharacterStream(int,Reader)</code>
242      * method because it informs the driver that the parameter value should be
243      * sent to the server as a <code>CLOB</code>.
244      *
245      * @param parameterIndex the first parameter is 1, the second is 2, ...
246      * @param reader an object that contains the data to set the parameter
247      * value to.
248      * @throws SQLException if a database access error occurs, this method is
249      * called on a closed PreparedStatement
250      */

251     public final void setClob(int parameterIndex, Reader JavaDoc reader)
252             throws SQLException JavaDoc {
253         getPreparedStatement().setClob(parameterIndex, reader);
254     }
255 }
256
Popular Tags