01: /*
02:
03: Derby - Class org.apache.derby.iapi.jdbc.BrokeredStatement40
04:
05: Licensed to the Apache Software Foundation (ASF) under one or more
06: contributor license agreements. See the NOTICE file distributed with
07: this work for additional information regarding copyright ownership.
08: The ASF licenses this file to you under the Apache License, Version 2.0
09: (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: package org.apache.derby.iapi.jdbc;
22:
23: import java.sql.SQLException;
24: import org.apache.derby.impl.jdbc.Util;
25: import org.apache.derby.iapi.reference.SQLState;
26:
27: public class BrokeredStatement40 extends BrokeredStatement {
28:
29: /**
30: * calls the superclass constructor to pass the parameters
31: *
32: * @param control BrokeredStatementControl
33: * @param jdbcLevel int
34: * @throws java.sql.SQLException
35: *
36: */
37:
38: BrokeredStatement40(BrokeredStatementControl control, int jdbcLevel)
39: throws SQLException {
40: super (control, jdbcLevel);
41: }
42:
43: /**
44: * Checks if the statement is closed.
45: *
46: * @return <code>true</code> if the statement is closed,
47: * <code>false</code> otherwise
48: * @exception SQLException if an error occurs
49: */
50: public final boolean isClosed() throws SQLException {
51: return getStatement().isClosed();
52: }
53:
54: /**
55: * Returns <code>this</code> if this class implements the interface
56: *
57: * @param interfaces a Class defining an interface
58: * @return an object that implements the interface
59: * @throws java.sql.SQLExption if no object if found that implements the
60: * interface
61: */
62: public <T> T unwrap(java.lang.Class<T> interfaces)
63: throws SQLException {
64: checkIfClosed();
65: //Derby does not implement non-standard methods on
66: //JDBC objects
67: try {
68: return interfaces.cast(this );
69: } catch (ClassCastException cce) {
70: throw Util.generateCsSQLException(
71: SQLState.UNABLE_TO_UNWRAP, interfaces);
72: }
73: }
74:
75: /**
76: * Forwards to the real Statement.
77: * @return true if the underlying Statement is poolable, false otherwise.
78: * @throws SQLException if the forwarding call fails.
79: */
80: public boolean isPoolable() throws SQLException {
81: return getStatement().isPoolable();
82: }
83:
84: /**
85: * Forwards to the real Statement.
86: * @param poolable the new value for the poolable hint.
87: * @throws SQLException if the forwarding call fails.
88: */
89: public void setPoolable(boolean poolable) throws SQLException {
90: getStatement().setPoolable(poolable);
91: }
92: }
|