KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Derby - Class org.apache.derby.iapi.jdbc.BrokeredStatement40
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 package org.apache.derby.iapi.jdbc;
22
23 import java.sql.SQLException JavaDoc;
24 import org.apache.derby.impl.jdbc.Util;
25 import org.apache.derby.iapi.reference.SQLState;
26
27
28 public class BrokeredStatement40 extends BrokeredStatement {
29     
30     /**
31      * calls the superclass constructor to pass the parameters
32      *
33      * @param control BrokeredStatementControl
34      * @param jdbcLevel int
35      * @throws java.sql.SQLException
36      *
37      */

38     
39     BrokeredStatement40(BrokeredStatementControl control, int jdbcLevel)
40                                                     throws SQLException JavaDoc {
41         super(control, jdbcLevel);
42     }
43     
44     /**
45      * Checks if the statement is closed.
46      *
47      * @return <code>true</code> if the statement is closed,
48      * <code>false</code> otherwise
49      * @exception SQLException if an error occurs
50      */

51     public final boolean isClosed() throws SQLException JavaDoc {
52         return getStatement().isClosed();
53     }
54     
55     /**
56      * Returns <code>this</code> if this class implements the interface
57      *
58      * @param interfaces a Class defining an interface
59      * @return an object that implements the interface
60      * @throws java.sql.SQLExption if no object if found that implements the
61      * interface
62      */

63     public <T> T unwrap(java.lang.Class JavaDoc<T> interfaces)
64                             throws SQLException JavaDoc {
65         checkIfClosed();
66         //Derby does not implement non-standard methods on
67
//JDBC objects
68
try {
69             return interfaces.cast(this);
70         } catch (ClassCastException JavaDoc cce) {
71             throw Util.generateCsSQLException(SQLState.UNABLE_TO_UNWRAP,
72                     interfaces);
73         }
74     }
75
76     /**
77      * Forwards to the real Statement.
78      * @return true if the underlying Statement is poolable, false otherwise.
79      * @throws SQLException if the forwarding call fails.
80      */

81     public boolean isPoolable() throws SQLException JavaDoc {
82         return getStatement().isPoolable();
83     }
84
85     /**
86      * Forwards to the real Statement.
87      * @param poolable the new value for the poolable hint.
88      * @throws SQLException if the forwarding call fails.
89      */

90     public void setPoolable(boolean poolable) throws SQLException JavaDoc {
91         getStatement().setPoolable(poolable);
92     }
93 }
94
Popular Tags