KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > jdbc > standard > StandardXAStatement


1 /*
2  * XAPool: Open Source XA JDBC Pool
3  * Copyright (C) 2003 Objectweb.org
4  * Initial Developer: Lutris Technologies Inc.
5  * Contact: xapool-public@lists.debian-sf.objectweb.org
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * 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 JavaDoc;
25 import java.sql.Statement JavaDoc;
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(
41         StandardXAConnectionHandle con,
42         int resultSetType,
43         int resultSetConcurrency,
44         int resultSetHoldability)
45         throws SQLException JavaDoc {
46         this.con = con;
47         this.resultSetType = resultSetType;
48         this.resultSetConcurrency = resultSetConcurrency;
49         this.resultSetHoldability = resultSetHoldability;
50         log = con.log;
51         statement = newStatement();
52     }
53
54     private Statement JavaDoc newStatement() throws SQLException JavaDoc {
55         if (resultSetType == 0 && resultSetConcurrency == 0 && resultSetHoldability == 0) {
56             return con.con.createStatement();
57         } else if (resultSetHoldability == 0) {
58             return con.con.createStatement(resultSetType, resultSetConcurrency);
59         } else return con.con.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
60     }
61
62     /**
63      * Close this statement.
64      */

65     public synchronized void close() throws SQLException JavaDoc {
66         super.close(); // we do not reuse the Statement, we have to close it
67
closed = true;
68     }
69
70
71     /**
72      * Exception management : catch or throw the exception
73      */

74     public void catchInvoke(SQLException JavaDoc sqlException) throws SQLException JavaDoc {
75         //ConnectionEvent event = new ConnectionEvent (con.pooledCon);
76
//con.pooledCon.connectionErrorOccurred(event);
77
throw (sqlException);
78     }
79
80 }
81
Popular Tags