KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Derby - Class org.apache.derby.iapi.jdbc.BrokeredConnection30
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.sql.Statement JavaDoc;
25 import java.sql.PreparedStatement JavaDoc;
26 import java.sql.CallableStatement JavaDoc;
27 import java.sql.SQLException JavaDoc;
28 import java.sql.Savepoint JavaDoc;
29 import org.apache.derby.iapi.reference.JDBC30Translation;
30
31 /**
32     Extends BrokeredConnection to provide the JDBC 3.0 connection methods.
33  */

34 public class BrokeredConnection30 extends BrokeredConnection
35 {
36
37     public BrokeredConnection30(BrokeredConnectionControl control)
38     {
39         super(control);
40     }
41
42     public final Statement JavaDoc createStatement(int resultSetType,
43                                  int resultSetConcurrency,
44                                  int resultSetHoldability)
45                                  throws SQLException JavaDoc {
46         try {
47             resultSetHoldability = statementHoldabilityCheck(resultSetHoldability);
48             return control.wrapStatement(getRealConnection().createStatement(resultSetType,
49                     resultSetConcurrency, resultSetHoldability));
50         }
51         catch (SQLException JavaDoc se)
52         {
53             notifyException(se);
54             throw se;
55         }
56     }
57     public final CallableStatement JavaDoc prepareCall(String JavaDoc sql,
58                                      int resultSetType,
59                                      int resultSetConcurrency,
60                                      int resultSetHoldability)
61                                      throws SQLException JavaDoc {
62         try {
63             resultSetHoldability = statementHoldabilityCheck(resultSetHoldability);
64             return control.wrapStatement(
65                 getRealConnection().prepareCall(sql, resultSetType,
66                         resultSetConcurrency, resultSetHoldability), sql);
67         }
68         catch (SQLException JavaDoc se)
69         {
70             notifyException(se);
71             throw se;
72         }
73     }
74
75     public final Savepoint JavaDoc setSavepoint()
76         throws SQLException JavaDoc
77     {
78         try {
79             control.checkSavepoint();
80             return getRealConnection().setSavepoint();
81         }
82         catch (SQLException JavaDoc se)
83         {
84             notifyException(se);
85             throw se;
86         }
87     }
88
89     public final Savepoint JavaDoc setSavepoint(String JavaDoc name)
90         throws SQLException JavaDoc
91     {
92         try {
93             control.checkSavepoint();
94             return getRealConnection().setSavepoint(name);
95         }
96         catch (SQLException JavaDoc se)
97         {
98             notifyException(se);
99             throw se;
100         }
101     }
102
103     public final void rollback(Savepoint JavaDoc savepoint)
104         throws SQLException JavaDoc
105     {
106         try {
107             control.checkRollback();
108             getRealConnection().rollback(savepoint);
109         }
110         catch (SQLException JavaDoc se)
111         {
112             notifyException(se);
113             throw se;
114         }
115     }
116
117     public final void releaseSavepoint(Savepoint JavaDoc savepoint)
118         throws SQLException JavaDoc
119     {
120         try {
121             getRealConnection().releaseSavepoint(savepoint);
122         }
123         catch (SQLException JavaDoc se)
124         {
125             notifyException(se);
126             throw se;
127         }
128     }
129
130
131     public final void setHoldability(int holdability)
132         throws SQLException JavaDoc
133     {
134         try {
135             holdability = control.checkHoldCursors(holdability, false);
136             getRealConnection().setHoldability(holdability);
137             stateHoldability = holdability;
138         }
139         catch (SQLException JavaDoc se)
140         {
141             notifyException(se);
142             throw se;
143         }
144     }
145
146     public final PreparedStatement JavaDoc prepareStatement(
147             String JavaDoc sql,
148             int autoGeneratedKeys)
149     throws SQLException JavaDoc
150     {
151         try {
152             return control.wrapStatement(getRealConnection().prepareStatement(sql, autoGeneratedKeys), sql, new Integer JavaDoc(autoGeneratedKeys));
153         }
154         catch (SQLException JavaDoc se)
155         {
156             notifyException(se);
157             throw se;
158         }
159     }
160
161     public final PreparedStatement JavaDoc prepareStatement(
162             String JavaDoc sql,
163             int[] columnIndexes)
164     throws SQLException JavaDoc
165     {
166         try {
167             return control.wrapStatement(getRealConnection().prepareStatement(sql, columnIndexes), sql, columnIndexes);
168         }
169         catch (SQLException JavaDoc se)
170         {
171             notifyException(se);
172             throw se;
173         }
174     }
175
176     public final PreparedStatement JavaDoc prepareStatement(
177             String JavaDoc sql,
178             String JavaDoc[] columnNames)
179     throws SQLException JavaDoc
180     {
181         try {
182             return control.wrapStatement(getRealConnection().prepareStatement(sql, columnNames), sql, columnNames);
183         }
184         catch (SQLException JavaDoc se)
185         {
186             notifyException(se);
187             throw se;
188         }
189     }
190
191     public BrokeredPreparedStatement newBrokeredStatement(BrokeredStatementControl statementControl, String JavaDoc sql, Object JavaDoc generatedKeys) throws SQLException JavaDoc {
192         return new BrokeredPreparedStatement30(statementControl, getJDBCLevel(), sql, generatedKeys);
193     }
194     public BrokeredCallableStatement newBrokeredStatement(BrokeredStatementControl statementControl, String JavaDoc sql) throws SQLException JavaDoc {
195         return new BrokeredCallableStatement30(statementControl, getJDBCLevel(), sql);
196     }
197
198     int getJDBCLevel() { return 3;}
199
200 }
201
Popular Tags