bug fixed for sharedPreparedStatement

This commit is contained in:
温少
2012-05-10 15:47:09 +08:00
parent 6641086507
commit 4dc8a4336f
7 changed files with 283 additions and 23 deletions
@@ -118,6 +118,7 @@ public class DruidPooledConnection implements javax.sql.PooledConnection, Connec
return;
}
stmt.getPreparedStatementHolder().decrementInUseCount();
if (holder.isPoolPreparedStatements()) {
holder.getStatementPool().put(stmt.getPreparedStatementHolder());
@@ -202,7 +203,7 @@ public class DruidPooledConnection implements javax.sql.PooledConnection, Connec
}
}
holder.getDataSource().initStatement(this, stmtHolder.getStatement());
initStatement(stmtHolder);
DruidPooledPreparedStatement rtnVal = new DruidPooledPreparedStatement(this, stmtHolder);
@@ -210,6 +211,11 @@ public class DruidPooledConnection implements javax.sql.PooledConnection, Connec
return rtnVal;
}
private void initStatement(PreparedStatementHolder stmtHolder) throws SQLException {
stmtHolder.incrementInUseCount();
holder.getDataSource().initStatement(this, stmtHolder.getStatement());
}
@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
@@ -236,7 +242,7 @@ public class DruidPooledConnection implements javax.sql.PooledConnection, Connec
}
}
holder.getDataSource().initStatement(this, stmtHolder.getStatement());
initStatement(stmtHolder);
DruidPooledPreparedStatement rtnVal = new DruidPooledPreparedStatement(this, stmtHolder);
@@ -271,7 +277,7 @@ public class DruidPooledConnection implements javax.sql.PooledConnection, Connec
}
}
holder.getDataSource().initStatement(this, stmtHolder.getStatement());
initStatement(stmtHolder);
DruidPooledPreparedStatement rtnVal = new DruidPooledPreparedStatement(this, stmtHolder);
@@ -302,7 +308,7 @@ public class DruidPooledConnection implements javax.sql.PooledConnection, Connec
}
}
holder.getDataSource().initStatement(this, stmtHolder.getStatement());
initStatement(stmtHolder);
DruidPooledPreparedStatement rtnVal = new DruidPooledPreparedStatement(this, stmtHolder);
@@ -333,7 +339,7 @@ public class DruidPooledConnection implements javax.sql.PooledConnection, Connec
}
}
holder.getDataSource().initStatement(this, stmtHolder.getStatement());
initStatement(stmtHolder);
DruidPooledPreparedStatement rtnVal = new DruidPooledPreparedStatement(this, stmtHolder);
@@ -364,7 +370,7 @@ public class DruidPooledConnection implements javax.sql.PooledConnection, Connec
}
}
holder.getDataSource().initStatement(this, stmtHolder.getStatement());
initStatement(stmtHolder);
DruidPooledPreparedStatement rtnVal = new DruidPooledPreparedStatement(this, stmtHolder);
@@ -397,7 +403,7 @@ public class DruidPooledConnection implements javax.sql.PooledConnection, Connec
}
}
holder.getDataSource().initStatement(this, stmtHolder.getStatement());
initStatement(stmtHolder);
DruidPooledCallableStatement rtnVal = new DruidPooledCallableStatement(this, stmtHolder);
@@ -432,7 +438,7 @@ public class DruidPooledConnection implements javax.sql.PooledConnection, Connec
}
}
holder.getDataSource().initStatement(this, stmtHolder.getStatement());
initStatement(stmtHolder);
DruidPooledCallableStatement rtnVal = new DruidPooledCallableStatement(this, stmtHolder);
@@ -465,7 +471,7 @@ public class DruidPooledConnection implements javax.sql.PooledConnection, Connec
}
}
holder.getDataSource().initStatement(this, stmtHolder.getStatement());
initStatement(stmtHolder);
DruidPooledCallableStatement rtnVal = new DruidPooledCallableStatement(this, stmtHolder);
holder.addTrace(rtnVal);