mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for pscache, if preparedStatement throw exception, removed from pscache. issue #1052
This commit is contained in:
@@ -164,7 +164,7 @@ public class DruidPooledConnection extends PoolableWrapper implements javax.sql.
|
||||
}
|
||||
|
||||
stmt.getPreparedStatementHolder().decrementInUseCount();
|
||||
if (stmt.isPooled() && holder.isPoolPreparedStatements()) {
|
||||
if (stmt.isPooled() && holder.isPoolPreparedStatements() && stmt.exceptionCount == 0) {
|
||||
holder.getStatementPool().put(stmt.getPreparedStatementHolder());
|
||||
|
||||
stmt.clearResultSet();
|
||||
|
||||
@@ -27,13 +27,14 @@ import java.util.List;
|
||||
*/
|
||||
public class DruidPooledStatement extends PoolableWrapper implements Statement {
|
||||
|
||||
private final static Log LOG = LogFactory.getLog(DruidPooledStatement.class);
|
||||
private final static Log LOG = LogFactory.getLog(DruidPooledStatement.class);
|
||||
|
||||
private final Statement stmt;
|
||||
protected DruidPooledConnection conn;
|
||||
protected List<ResultSet> resultSetTrace;
|
||||
protected boolean closed = false;
|
||||
protected int fetchRowPeak = -1;
|
||||
protected boolean closed = false;
|
||||
protected int fetchRowPeak = -1;
|
||||
protected int exceptionCount = 0;
|
||||
|
||||
public DruidPooledStatement(DruidPooledConnection conn, Statement stmt){
|
||||
super(stmt);
|
||||
@@ -60,6 +61,7 @@ public class DruidPooledStatement extends PoolableWrapper implements Statement {
|
||||
}
|
||||
|
||||
protected SQLException checkException(Throwable error) throws SQLException {
|
||||
exceptionCount++;
|
||||
return conn.handleException(error);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user