01: /*
02: * XAPool: Open Source XA JDBC Pool
03: * Copyright (C) 2003 Objectweb.org
04: * Initial Developer: Lutris Technologies Inc.
05: * Contact: xapool-public@lists.debian-sf.objectweb.org
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation; either
10: * version 2.1 of the License, or any later version.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this library; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20: * USA
21: */
22: package org.enhydra.jdbc.standard;
23:
24: import java.sql.SQLException;
25: import java.sql.Statement;
26: import org.enhydra.jdbc.core.CoreStatement;
27:
28: public class StandardXAStatement extends CoreStatement {
29:
30: private StandardXAConnectionHandle con;
31: // the StandardConnectionHandle that created this object
32: private boolean closed; // true when the Statement has been closed
33: private int resultSetType;
34: private int resultSetConcurrency;
35: private int resultSetHoldability;
36:
37: /**
38: * Constructor.
39: */
40: StandardXAStatement(StandardXAConnectionHandle con,
41: int resultSetType, int resultSetConcurrency,
42: int resultSetHoldability) throws SQLException {
43: this .con = con;
44: this .resultSetType = resultSetType;
45: this .resultSetConcurrency = resultSetConcurrency;
46: this .resultSetHoldability = resultSetHoldability;
47: log = con.log;
48: statement = newStatement();
49: }
50:
51: private Statement newStatement() throws SQLException {
52: if (resultSetType == 0 && resultSetConcurrency == 0
53: && resultSetHoldability == 0) {
54: return con.con.createStatement();
55: } else if (resultSetHoldability == 0) {
56: return con.con.createStatement(resultSetType,
57: resultSetConcurrency);
58: } else
59: return con.con.createStatement(resultSetType,
60: resultSetConcurrency, resultSetHoldability);
61: }
62:
63: /**
64: * Close this statement.
65: */
66: public synchronized void close() throws SQLException {
67: super .close(); // we do not reuse the Statement, we have to close it
68: closed = true;
69: }
70:
71: /**
72: * Exception management : catch or throw the exception
73: */
74: public void catchInvoke(SQLException sqlException)
75: throws SQLException {
76: //ConnectionEvent event = new ConnectionEvent (con.pooledCon);
77: //con.pooledCon.connectionErrorOccurred(event);
78: throw (sqlException);
79: }
80:
81: }
|