From f5dc99a24eaa111a15e72e9518bb8f531029f7c1 Mon Sep 17 00:00:00 2001 From: guredd Date: Fri, 18 Aug 2017 15:54:13 +0300 Subject: [PATCH] Bug 87429 --- src/com/mysql/jdbc/ConnectionImpl.java | 2 +- src/com/mysql/jdbc/ServerPreparedStatement.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/com/mysql/jdbc/ConnectionImpl.java b/src/com/mysql/jdbc/ConnectionImpl.java index bb488e78..6dc70cdc 100644 --- a/src/com/mysql/jdbc/ConnectionImpl.java +++ b/src/com/mysql/jdbc/ConnectionImpl.java @@ -4286,7 +4286,7 @@ public void recachePreparedStatement(ServerPreparedStatement pstmt) throws SQLEx if (getCachePreparedStatements() && pstmt.isPoolable()) { synchronized (this.serverSideStatementCache) { Object oldServerPrepStmt = this.serverSideStatementCache.put(makePreparedStatementCacheKey(pstmt.currentCatalog, pstmt.originalSql), pstmt); - if (oldServerPrepStmt != null) { + if (oldServerPrepStmt != null && oldServerPrepStmt != pstmt) { ((ServerPreparedStatement) oldServerPrepStmt).isCached = false; ((ServerPreparedStatement) oldServerPrepStmt).realClose(true, true); } diff --git a/src/com/mysql/jdbc/ServerPreparedStatement.java b/src/com/mysql/jdbc/ServerPreparedStatement.java index 30c7ef47..ee6dc3d3 100644 --- a/src/com/mysql/jdbc/ServerPreparedStatement.java +++ b/src/com/mysql/jdbc/ServerPreparedStatement.java @@ -566,7 +566,6 @@ public void close() throws SQLException { synchronized (locallyScopedConn.getConnectionMutex()) { if (this.isCached && isPoolable() && !this.isClosed) { clearParameters(); - this.isClosed = true; this.connection.recachePreparedStatement(this); return; }