package org.enhydra.jdbc.standard;
import java.sql.SQLException;
public class StandardXAPreparedStatement extends StandardPreparedStatement {
private StandardXAConnectionHandle con;
public String sql;
public int resultSetType;
public int resultSetConcurrency;
public int resultSetHoldability;
public int autoGeneratedKeys;
StandardXAPreparedStatement(
StandardXAConnectionHandle con_,
String sql_,
int resultSetType_,
int resultSetConcurrency_,
int resultSetHoldability_)
throws SQLException {
this.con = con_;
this.sql = sql_;
this.key = sql_ + resultSetType_ + resultSetConcurrency_ + resultSetHoldability_;
this.resultSetType = resultSetType_;
this.resultSetConcurrency = resultSetConcurrency_;
this.resultSetHoldability = resultSetHoldability_;
log = con_.log;
log.debug(
"StandardXAPreparedStatement: Create an XAPreparedStatement with sql='"
+ sql
+ "'");
key =
sql
+ resultSetType
+ resultSetConcurrency
+ resultSetHoldability
+ ((con.tx != null) ? true : false);
ps =
con.checkPreparedCache(
sql,
resultSetType,
resultSetConcurrency,
resultSetHoldability,
key);
}
StandardXAPreparedStatement(
StandardXAConnectionHandle con_,
String sql_,
int autoGeneratedKeys_)
throws SQLException {
this.con = con_;
this.sql = sql_;
this.key = sql_ + autoGeneratedKeys_;
this.autoGeneratedKeys= autoGeneratedKeys_;
log = con_.log;
log.debug(
"StandardXAPreparedStatement: Create an XAPreparedStatement with sql='"
+ sql
+ "'");
key =
sql
+ autoGeneratedKeys
+ ((con.tx != null) ? true : false);
ps =
con.checkPreparedCache(
sql,
autoGeneratedKeys,
key);
}
public synchronized void close() throws SQLException {
log.debug(
"StandardXAPreparedStatement:close the XA prepared statement");
closed = true;
if (con.preparedStmtCacheSize == 0) {
log.debug(
"StandardXAPreparedStatement:close preparedStmtCacheSize == 0");
if (ps != null) {
ps.close();
}
} else {
log.debug(
"StandardXAPreparedStatement:close preparedStmtCacheSize="
+ "'"
+ con.preparedStmtCacheSize
+ "'");
con.returnToCache(key);
}
}
public void catchInvoke(SQLException sqlException) throws SQLException {
throw (sqlException);
}
}