OSDN Git Service

i
[luz/luz.git] / luz2 / src / com / lavans / luz2 / sql / pool / PooledStatement.java
1 /* $Id: PooledStatement.java 94 2008-12-18 11:07:17Z dobashi $\r
2  * created: 2005/06/17\r
3  *\r
4  */\r
5 package com.lavans.luz2.sql.pool;\r
6 \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
12 \r
13 /**\r
14  * 親のConnection#close()が呼ばれたときに、子のStatementを\r
15  * 自動的にclose()するためのラッパークラス。\r
16  *\r
17  * @author dobashi\r
18  *\r
19  */\r
20 public class PooledStatement implements Statement {\r
21         PooledConnection parent = null;\r
22         private Statement st = null;\r
23 \r
24         public PooledStatement(PooledConnection con, Statement st){\r
25                 parent = con;\r
26                 this.st = st;\r
27         }\r
28 \r
29         /**\r
30          * 明示的にclose()が呼ばれた場合は親に通知し、\r
31          * 親のListから削除してもらう。\r
32          *\r
33          * @throws java.sql.SQLException\r
34          */\r
35         public void close() throws SQLException {\r
36                 parent.removeStatement(this);\r
37                 st.close();\r
38         }\r
39 \r
40         /**\r
41          * @param arg0\r
42          * @throws java.sql.SQLException\r
43          */\r
44         public void addBatch(String arg0) throws SQLException {\r
45                 st.addBatch(arg0);\r
46         }\r
47         /**\r
48          * @throws java.sql.SQLException\r
49          */\r
50         public void cancel() throws SQLException {\r
51                 st.cancel();\r
52         }\r
53         /**\r
54          * @throws java.sql.SQLException\r
55          */\r
56         public void clearBatch() throws SQLException {\r
57                 st.clearBatch();\r
58         }\r
59         /**\r
60          * @throws java.sql.SQLException\r
61          */\r
62         public void clearWarnings() throws SQLException {\r
63                 st.clearWarnings();\r
64         }\r
65 \r
66         /**\r
67          * @param arg0\r
68          * @return\r
69          * @throws java.sql.SQLException\r
70          */\r
71         public boolean execute(String arg0) throws SQLException {\r
72                 return st.execute(arg0);\r
73         }\r
74         /**\r
75          * @param arg0\r
76          * @param arg1\r
77          * @return\r
78          * @throws java.sql.SQLException\r
79          */\r
80         public boolean execute(String arg0, int arg1) throws SQLException {\r
81                 return st.execute(arg0, arg1);\r
82         }\r
83         /**\r
84          * @param arg0\r
85          * @param arg1\r
86          * @return\r
87          * @throws java.sql.SQLException\r
88          */\r
89         public boolean execute(String arg0, int[] arg1) throws SQLException {\r
90                 return st.execute(arg0, arg1);\r
91         }\r
92         /**\r
93          * @param arg0\r
94          * @param arg1\r
95          * @return\r
96          * @throws java.sql.SQLException\r
97          */\r
98         public boolean execute(String arg0, String[] arg1) throws SQLException {\r
99                 return st.execute(arg0, arg1);\r
100         }\r
101         /**\r
102          * @return\r
103          * @throws java.sql.SQLException\r
104          */\r
105         public int[] executeBatch() throws SQLException {\r
106                 return st.executeBatch();\r
107         }\r
108         /**\r
109          * @param arg0\r
110          * @return\r
111          * @throws java.sql.SQLException\r
112          */\r
113         public ResultSet executeQuery(String arg0) throws SQLException {\r
114                 return st.executeQuery(arg0);\r
115         }\r
116         /**\r
117          * @param arg0\r
118          * @return\r
119          * @throws java.sql.SQLException\r
120          */\r
121         public int executeUpdate(String arg0) throws SQLException {\r
122                 return st.executeUpdate(arg0);\r
123         }\r
124         /**\r
125          * @param arg0\r
126          * @param arg1\r
127          * @return\r
128          * @throws java.sql.SQLException\r
129          */\r
130         public int executeUpdate(String arg0, int arg1) throws SQLException {\r
131                 return st.executeUpdate(arg0, arg1);\r
132         }\r
133         /**\r
134          * @param arg0\r
135          * @param arg1\r
136          * @return\r
137          * @throws java.sql.SQLException\r
138          */\r
139         public int executeUpdate(String arg0, int[] arg1) throws SQLException {\r
140                 return st.executeUpdate(arg0, arg1);\r
141         }\r
142         /**\r
143          * @param arg0\r
144          * @param arg1\r
145          * @return\r
146          * @throws java.sql.SQLException\r
147          */\r
148         public int executeUpdate(String arg0, String[] arg1) throws SQLException {\r
149                 return st.executeUpdate(arg0, arg1);\r
150         }\r
151         /**\r
152          * @return\r
153          * @throws java.sql.SQLException\r
154          */\r
155         public Connection getConnection() throws SQLException {\r
156                 return st.getConnection();\r
157         }\r
158         /**\r
159          * @return\r
160          * @throws java.sql.SQLException\r
161          */\r
162         public int getFetchDirection() throws SQLException {\r
163                 return st.getFetchDirection();\r
164         }\r
165         /**\r
166          * @return\r
167          * @throws java.sql.SQLException\r
168          */\r
169         public int getFetchSize() throws SQLException {\r
170                 return st.getFetchSize();\r
171         }\r
172         /**\r
173          * @return\r
174          * @throws java.sql.SQLException\r
175          */\r
176         public ResultSet getGeneratedKeys() throws SQLException {\r
177                 return st.getGeneratedKeys();\r
178         }\r
179         /**\r
180          * @return\r
181          * @throws java.sql.SQLException\r
182          */\r
183         public int getMaxFieldSize() throws SQLException {\r
184                 return st.getMaxFieldSize();\r
185         }\r
186         /**\r
187          * @return\r
188          * @throws java.sql.SQLException\r
189          */\r
190         public int getMaxRows() throws SQLException {\r
191                 return st.getMaxRows();\r
192         }\r
193         /**\r
194          * @return\r
195          * @throws java.sql.SQLException\r
196          */\r
197         public boolean getMoreResults() throws SQLException {\r
198                 return st.getMoreResults();\r
199         }\r
200         /**\r
201          * @param arg0\r
202          * @return\r
203          * @throws java.sql.SQLException\r
204          */\r
205         public boolean getMoreResults(int arg0) throws SQLException {\r
206                 return st.getMoreResults(arg0);\r
207         }\r
208         /**\r
209          * @return\r
210          * @throws java.sql.SQLException\r
211          */\r
212         public int getQueryTimeout() throws SQLException {\r
213                 return st.getQueryTimeout();\r
214         }\r
215         /**\r
216          * @return\r
217          * @throws java.sql.SQLException\r
218          */\r
219         public ResultSet getResultSet() throws SQLException {\r
220                 return st.getResultSet();\r
221         }\r
222         /**\r
223          * @return\r
224          * @throws java.sql.SQLException\r
225          */\r
226         public int getResultSetConcurrency() throws SQLException {\r
227                 return st.getResultSetConcurrency();\r
228         }\r
229         /**\r
230          * @return\r
231          * @throws java.sql.SQLException\r
232          */\r
233         public int getResultSetHoldability() throws SQLException {\r
234                 return st.getResultSetHoldability();\r
235         }\r
236         /**\r
237          * @return\r
238          * @throws java.sql.SQLException\r
239          */\r
240         public int getResultSetType() throws SQLException {\r
241                 return st.getResultSetType();\r
242         }\r
243         /**\r
244          * @return\r
245          * @throws java.sql.SQLException\r
246          */\r
247         public int getUpdateCount() throws SQLException {\r
248                 return st.getUpdateCount();\r
249         }\r
250         /**\r
251          * @return\r
252          * @throws java.sql.SQLException\r
253          */\r
254         public SQLWarning getWarnings() throws SQLException {\r
255                 return st.getWarnings();\r
256         }\r
257 \r
258         /**\r
259          * @param arg0\r
260          * @throws java.sql.SQLException\r
261          */\r
262         public void setCursorName(String arg0) throws SQLException {\r
263                 st.setCursorName(arg0);\r
264         }\r
265         /**\r
266          * @param arg0\r
267          * @throws java.sql.SQLException\r
268          */\r
269         public void setEscapeProcessing(boolean arg0) throws SQLException {\r
270                 st.setEscapeProcessing(arg0);\r
271         }\r
272         /**\r
273          * @param arg0\r
274          * @throws java.sql.SQLException\r
275          */\r
276         public void setFetchDirection(int arg0) throws SQLException {\r
277                 st.setFetchDirection(arg0);\r
278         }\r
279         /**\r
280          * @param arg0\r
281          * @throws java.sql.SQLException\r
282          */\r
283         public void setFetchSize(int arg0) throws SQLException {\r
284                 st.setFetchSize(arg0);\r
285         }\r
286         /**\r
287          * @param arg0\r
288          * @throws java.sql.SQLException\r
289          */\r
290         public void setMaxFieldSize(int arg0) throws SQLException {\r
291                 st.setMaxFieldSize(arg0);\r
292         }\r
293         /**\r
294          * @param arg0\r
295          * @throws java.sql.SQLException\r
296          */\r
297         public void setMaxRows(int arg0) throws SQLException {\r
298                 st.setMaxRows(arg0);\r
299         }\r
300         /**\r
301          * @param arg0\r
302          * @throws java.sql.SQLException\r
303          */\r
304         public void setQueryTimeout(int arg0) throws SQLException {\r
305                 st.setQueryTimeout(arg0);\r
306         }\r
307 \r
308         /**\r
309          * @return\r
310          * @throws SQLException\r
311          * @see java.sql.Statement#isClosed()\r
312          */\r
313         public boolean isClosed() throws SQLException {\r
314                 return st.isClosed();\r
315         }\r
316 \r
317         /**\r
318          * @return\r
319          * @throws SQLException\r
320          * @see java.sql.Statement#isPoolable()\r
321          */\r
322         public boolean isPoolable() throws SQLException {\r
323                 return st.isPoolable();\r
324         }\r
325 \r
326         /**\r
327          * @param iface\r
328          * @return\r
329          * @throws SQLException\r
330          * @see java.sql.Wrapper#isWrapperFor(java.lang.Class)\r
331          */\r
332         public boolean isWrapperFor(Class<?> iface) throws SQLException {\r
333                 return st.isWrapperFor(iface);\r
334         }\r
335 \r
336         /**\r
337          * @param poolable\r
338          * @throws SQLException\r
339          * @see java.sql.Statement#setPoolable(boolean)\r
340          */\r
341         public void setPoolable(boolean poolable) throws SQLException {\r
342                 st.setPoolable(poolable);\r
343         }\r
344 \r
345         /**\r
346          * @param <T>\r
347          * @param iface\r
348          * @return\r
349          * @throws SQLException\r
350          * @see java.sql.Wrapper#unwrap(java.lang.Class)\r
351          */\r
352         @SuppressWarnings("unchecked")\r
353         public <T> T unwrap(Class<T> iface) throws SQLException {\r
354                 return (T)this;\r
355         }\r
356 }\r