1 22 package org.enhydra.jdbc.standard; 23 24 import java.sql.SQLException ; 25 26 public class StandardXAPreparedStatement extends StandardPreparedStatement { 27 28 private StandardXAConnectionHandle con; 29 public String sql; 31 public int resultSetType; 32 public int resultSetConcurrency; 33 public int resultSetHoldability; 34 public int autoGeneratedKeys; 35 36 StandardXAPreparedStatement( 37 StandardXAConnectionHandle con_, 38 String sql_, 39 int resultSetType_, 40 int resultSetConcurrency_, 41 int resultSetHoldability_) 42 throws SQLException { 43 this.con = con_; 44 this.sql = sql_; 45 this.key = sql_ + resultSetType_ + resultSetConcurrency_ + resultSetHoldability_; 46 this.resultSetType = resultSetType_; 47 this.resultSetConcurrency = resultSetConcurrency_; 48 this.resultSetHoldability = resultSetHoldability_; 49 50 log = con_.log; 51 log.debug( 52 "StandardXAPreparedStatement: Create an XAPreparedStatement with sql='" 53 + sql 54 + "'"); 55 56 key = 57 sql 58 + resultSetType 59 + resultSetConcurrency 60 + resultSetHoldability 61 + ((con.tx != null) ? true : false); 62 ps = 63 con.checkPreparedCache( 64 sql, 65 resultSetType, 66 resultSetConcurrency, 67 resultSetHoldability, 68 key); 69 } 72 73 StandardXAPreparedStatement( 74 StandardXAConnectionHandle con_, 75 String sql_, 76 int autoGeneratedKeys_) 77 throws SQLException { 78 this.con = con_; 79 this.sql = sql_; 80 this.key = sql_ + autoGeneratedKeys_; 81 this.autoGeneratedKeys= autoGeneratedKeys_; 82 83 log = con_.log; 84 log.debug( 85 "StandardXAPreparedStatement: Create an XAPreparedStatement with sql='" 86 + sql 87 + "'"); 88 89 key = 90 sql 91 + autoGeneratedKeys 92 + ((con.tx != null) ? true : false); 93 ps = 94 con.checkPreparedCache( 95 sql, 96 autoGeneratedKeys, 97 key); 98 } 101 102 103 106 public synchronized void close() throws SQLException { 107 log.debug( 108 "StandardXAPreparedStatement:close the XA prepared statement"); 109 closed = true; 111 if (con.preparedStmtCacheSize == 0) { 112 log.debug( 113 "StandardXAPreparedStatement:close preparedStmtCacheSize == 0"); 114 if (ps != null) { 115 ps.close(); } 117 } else { 118 log.debug( 119 "StandardXAPreparedStatement:close preparedStmtCacheSize=" 120 + "'" 121 + con.preparedStmtCacheSize 122 + "'"); 123 con.returnToCache(key); 124 } 126 } 127 128 129 132 public void catchInvoke(SQLException sqlException) throws SQLException { 133 throw (sqlException); 136 } 137 138 } 139 | Popular Tags |