1 /* $Id: PooledStatement.java 94 2008-12-18 11:07:17Z dobashi $
\r
2 * created: 2005/06/17
\r
5 package com.lavans.luz2.sql.pool;
\r
7 import java.sql.Connection;
\r
8 import java.sql.ResultSet;
\r
9 import java.sql.SQLException;
\r
10 import java.sql.SQLWarning;
\r
11 import java.sql.Statement;
\r
14 * 親のConnection#close()が呼ばれたときに、子のStatementを
\r
15 * 自動的にclose()するためのラッパークラス。
\r
20 public class PooledStatement implements Statement {
\r
21 PooledConnection parent = null;
\r
22 private Statement st = null;
\r
24 public PooledStatement(PooledConnection con, Statement st){
\r
30 * 明示的にclose()が呼ばれた場合は親に通知し、
\r
33 * @throws java.sql.SQLException
\r
35 public void close() throws SQLException {
\r
36 parent.removeStatement(this);
\r
42 * @throws java.sql.SQLException
\r
44 public void addBatch(String arg0) throws SQLException {
\r
48 * @throws java.sql.SQLException
\r
50 public void cancel() throws SQLException {
\r
54 * @throws java.sql.SQLException
\r
56 public void clearBatch() throws SQLException {
\r
60 * @throws java.sql.SQLException
\r
62 public void clearWarnings() throws SQLException {
\r
69 * @throws java.sql.SQLException
\r
71 public boolean execute(String arg0) throws SQLException {
\r
72 return st.execute(arg0);
\r
78 * @throws java.sql.SQLException
\r
80 public boolean execute(String arg0, int arg1) throws SQLException {
\r
81 return st.execute(arg0, arg1);
\r
87 * @throws java.sql.SQLException
\r
89 public boolean execute(String arg0, int[] arg1) throws SQLException {
\r
90 return st.execute(arg0, arg1);
\r
96 * @throws java.sql.SQLException
\r
98 public boolean execute(String arg0, String[] arg1) throws SQLException {
\r
99 return st.execute(arg0, arg1);
\r
103 * @throws java.sql.SQLException
\r
105 public int[] executeBatch() throws SQLException {
\r
106 return st.executeBatch();
\r
111 * @throws java.sql.SQLException
\r
113 public ResultSet executeQuery(String arg0) throws SQLException {
\r
114 return st.executeQuery(arg0);
\r
119 * @throws java.sql.SQLException
\r
121 public int executeUpdate(String arg0) throws SQLException {
\r
122 return st.executeUpdate(arg0);
\r
128 * @throws java.sql.SQLException
\r
130 public int executeUpdate(String arg0, int arg1) throws SQLException {
\r
131 return st.executeUpdate(arg0, arg1);
\r
137 * @throws java.sql.SQLException
\r
139 public int executeUpdate(String arg0, int[] arg1) throws SQLException {
\r
140 return st.executeUpdate(arg0, arg1);
\r
146 * @throws java.sql.SQLException
\r
148 public int executeUpdate(String arg0, String[] arg1) throws SQLException {
\r
149 return st.executeUpdate(arg0, arg1);
\r
153 * @throws java.sql.SQLException
\r
155 public Connection getConnection() throws SQLException {
\r
156 return st.getConnection();
\r
160 * @throws java.sql.SQLException
\r
162 public int getFetchDirection() throws SQLException {
\r
163 return st.getFetchDirection();
\r
167 * @throws java.sql.SQLException
\r
169 public int getFetchSize() throws SQLException {
\r
170 return st.getFetchSize();
\r
174 * @throws java.sql.SQLException
\r
176 public ResultSet getGeneratedKeys() throws SQLException {
\r
177 return st.getGeneratedKeys();
\r
181 * @throws java.sql.SQLException
\r
183 public int getMaxFieldSize() throws SQLException {
\r
184 return st.getMaxFieldSize();
\r
188 * @throws java.sql.SQLException
\r
190 public int getMaxRows() throws SQLException {
\r
191 return st.getMaxRows();
\r
195 * @throws java.sql.SQLException
\r
197 public boolean getMoreResults() throws SQLException {
\r
198 return st.getMoreResults();
\r
203 * @throws java.sql.SQLException
\r
205 public boolean getMoreResults(int arg0) throws SQLException {
\r
206 return st.getMoreResults(arg0);
\r
210 * @throws java.sql.SQLException
\r
212 public int getQueryTimeout() throws SQLException {
\r
213 return st.getQueryTimeout();
\r
217 * @throws java.sql.SQLException
\r
219 public ResultSet getResultSet() throws SQLException {
\r
220 return st.getResultSet();
\r
224 * @throws java.sql.SQLException
\r
226 public int getResultSetConcurrency() throws SQLException {
\r
227 return st.getResultSetConcurrency();
\r
231 * @throws java.sql.SQLException
\r
233 public int getResultSetHoldability() throws SQLException {
\r
234 return st.getResultSetHoldability();
\r
238 * @throws java.sql.SQLException
\r
240 public int getResultSetType() throws SQLException {
\r
241 return st.getResultSetType();
\r
245 * @throws java.sql.SQLException
\r
247 public int getUpdateCount() throws SQLException {
\r
248 return st.getUpdateCount();
\r
252 * @throws java.sql.SQLException
\r
254 public SQLWarning getWarnings() throws SQLException {
\r
255 return st.getWarnings();
\r
260 * @throws java.sql.SQLException
\r
262 public void setCursorName(String arg0) throws SQLException {
\r
263 st.setCursorName(arg0);
\r
267 * @throws java.sql.SQLException
\r
269 public void setEscapeProcessing(boolean arg0) throws SQLException {
\r
270 st.setEscapeProcessing(arg0);
\r
274 * @throws java.sql.SQLException
\r
276 public void setFetchDirection(int arg0) throws SQLException {
\r
277 st.setFetchDirection(arg0);
\r
281 * @throws java.sql.SQLException
\r
283 public void setFetchSize(int arg0) throws SQLException {
\r
284 st.setFetchSize(arg0);
\r
288 * @throws java.sql.SQLException
\r
290 public void setMaxFieldSize(int arg0) throws SQLException {
\r
291 st.setMaxFieldSize(arg0);
\r
295 * @throws java.sql.SQLException
\r
297 public void setMaxRows(int arg0) throws SQLException {
\r
298 st.setMaxRows(arg0);
\r
302 * @throws java.sql.SQLException
\r
304 public void setQueryTimeout(int arg0) throws SQLException {
\r
305 st.setQueryTimeout(arg0);
\r
310 * @throws SQLException
\r
311 * @see java.sql.Statement#isClosed()
\r
313 public boolean isClosed() throws SQLException {
\r
314 return st.isClosed();
\r
319 * @throws SQLException
\r
320 * @see java.sql.Statement#isPoolable()
\r
322 public boolean isPoolable() throws SQLException {
\r
323 return st.isPoolable();
\r
329 * @throws SQLException
\r
330 * @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
\r
332 public boolean isWrapperFor(Class<?> iface) throws SQLException {
\r
333 return st.isWrapperFor(iface);
\r
338 * @throws SQLException
\r
339 * @see java.sql.Statement#setPoolable(boolean)
\r
341 public void setPoolable(boolean poolable) throws SQLException {
\r
342 st.setPoolable(poolable);
\r
349 * @throws SQLException
\r
350 * @see java.sql.Wrapper#unwrap(java.lang.Class)
\r
352 @SuppressWarnings("unchecked")
\r
353 public <T> T unwrap(Class<T> iface) throws SQLException {
\r