From 2847fad43e1aa15f934108ce8f5e8dbe1fb1962d Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Mon, 20 Sep 2010 21:53:04 -0600 Subject: [PATCH] Pass encoding argument to pooled connections --- ChangeLog | 5 +++++ sql/database.lisp | 4 ++-- sql/pool.lisp | 5 +++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3515695..0cf32cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-09-20 Kevin Rosenberg + * Version 5.1.4 + * sql/{pool,database}.lisp: Pass encoding argument to + connections made from pool and with reconnect. + 2010-08-16 Kevin Rosenberg * Version 5.1.3 * db-odbc/odbc-{api,dbi}.lisp: Commit patch from diff --git a/sql/database.lisp b/sql/database.lisp index bb87046..982973e 100644 --- a/sql/database.lisp +++ b/sql/database.lisp @@ -104,7 +104,7 @@ be taken from this pool." :verbose nil)) (if pool - (let ((conn (acquire-from-pool connection-spec database-type pool))) + (let ((conn (acquire-from-pool connection-spec database-type pool encoding))) (when make-default (setq *default-database* conn)) conn) (let* ((db-name (database-name-from-spec connection-spec database-type)) @@ -234,7 +234,7 @@ database connection cannot be closed, an error is signalled." (ignore-errors (disconnect :database db)) (disconnect :database db :error nil))) - (connect (connection-spec db)))) + (connect (connection-spec db) :encoding (encoding db)))) (defun status (&optional full) diff --git a/sql/pool.lisp b/sql/pool.lisp index 66cbaf7..e4f4b60 100644 --- a/sql/pool.lisp +++ b/sql/pool.lisp @@ -33,7 +33,7 @@ that should, on avg keep the free connections about this size.") :initform (make-process-lock "Connection pool")))) -(defun acquire-from-pool (connection-spec database-type &optional pool) +(defun acquire-from-pool (connection-spec database-type &optional pool encoding) "Try to find a working database connection in the pool or create a new one if needed. This performs 1 query against the DB to ensure it's still valid. When possible (postgres, mssql) that query will be a reset @@ -68,7 +68,8 @@ Disconnecting.~%" (let ((conn (connect (connection-spec pool) :database-type (pool-database-type pool) :if-exists :new - :make-default nil))) + :make-default nil + :encoding encoding))) (with-process-lock ((conn-pool-lock pool) "new conection") (push conn (all-connections pool)) (setf (conn-pool conn) pool)) -- 2.34.1