From d2518bfbfd6a222e6f022ebd52ccce86fa2af926 Mon Sep 17 00:00:00 2001 From: Russ Tyndall Date: Fri, 9 Oct 2009 15:33:47 -0400 Subject: [PATCH] Made release-to-conn-pool a method. Also made postgresql execute DISCARD ALL; when getting a conn from the pool or putting it back --- db-postgresql-socket3/sql.lisp | 4 ++++ sql/pool.lisp | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/db-postgresql-socket3/sql.lisp b/db-postgresql-socket3/sql.lisp index 8428d48..9b73b0d 100644 --- a/db-postgresql-socket3/sql.lisp +++ b/db-postgresql-socket3/sql.lisp @@ -155,6 +155,10 @@ (cl-postgres:close-database (database-connection database)) t) +(defmethod clsql-sys::release-to-conn-pool :before ((conn postgresql-socket3-database)) + ;; This resets the connection to "New" state + (database-execute-command "DISCARD ALL;" conn)) + (defvar *include-field-names* nil) diff --git a/sql/pool.lisp b/sql/pool.lisp index d1c0a23..f364508 100644 --- a/sql/pool.lisp +++ b/sql/pool.lisp @@ -44,7 +44,8 @@ command to put the connection back into its default state." (handler-case (case (database-underlying-type pconn) (:postgresql - (database-execute-command "RESET ALL" pconn)) + ;; This resets the connection to "New" state + (database-execute-command "DISCARD ALL;" pconn)) (:mysql (database-query "SHOW ERRORS LIMIT 1" pconn nil nil)) (:mssql @@ -74,7 +75,7 @@ Disconnecting.~%" (setf (conn-pool conn) pool)) conn))) -(defun release-to-conn-pool (conn) +(defmethod release-to-conn-pool (conn) (let ((pool (conn-pool conn))) (with-process-lock ((conn-pool-lock pool) "Release to pool") (vector-push-extend conn (free-connections pool))))) -- 2.34.1