Pass encoding argument to pooled connections
authorKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 21 Sep 2010 03:53:04 +0000 (21:53 -0600)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 21 Sep 2010 03:53:04 +0000 (21:53 -0600)
ChangeLog
sql/database.lisp
sql/pool.lisp

index 35156957b493e8e5556835a402d0e222f52fa0ed..0cf32cf11a4a58ffdff103108259b8da57468130 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-20  Kevin Rosenberg <kevin@rosenberg.net>
+       * Version 5.1.4
+       * sql/{pool,database}.lisp: Pass encoding argument to
+       connections made from pool and with reconnect.
+
 2010-08-16  Kevin Rosenberg <kevin@rosenberg.net>
        * Version 5.1.3
        * db-odbc/odbc-{api,dbi}.lisp: Commit patch from
 2010-08-16  Kevin Rosenberg <kevin@rosenberg.net>
        * Version 5.1.3
        * db-odbc/odbc-{api,dbi}.lisp: Commit patch from
index bb87046fb6c8ce494976b9293efbc11d997b7e9d..982973e6d23695d84b96f11968a246add9220780 100644 (file)
@@ -104,7 +104,7 @@ be taken from this pool."
                   :verbose nil))
 
   (if 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))
         (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)))
 
           (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)
 
 
 (defun status (&optional full)
index 66cbaf76125d10b2a0ee600ae8044148635d3a44..e4f4b608b6d429549ae2d868cd64dcce920b54d3 100644 (file)
@@ -33,7 +33,7 @@ that should, on avg keep the free connections about this size.")
         :initform (make-process-lock "Connection pool"))))
 
 
         :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
   "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
    (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))
      (with-process-lock ((conn-pool-lock pool) "new conection")
        (push conn (all-connections pool))
        (setf (conn-pool conn) pool))