From 29c15e4e9cf9cbb5ccfe33c0af59a24d0614bef9 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Fri, 16 Apr 2004 17:50:35 +0000 Subject: [PATCH] r9034: Automated commit for Debian build of clsql upstream-version-2.7.3 --- ChangeLog | 3 +++ base/conditions.lisp | 6 ++++++ base/database.lisp | 21 ++++++++++++++++++--- debian/changelog | 2 +- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index bd0530e..b186b5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +16 Apr 2004 Kevin Rosenberg (kevin@rosenberg.net) + * Version 2.7.3: Implement RECONNECT + 15 Apr 2004 Kevin Rosenberg (kevin@rosenberg.net) * Version 2.7.2: Fix ODBC on Lispworks Windows diff --git a/base/conditions.lisp b/base/conditions.lisp index a84f654..81a1226 100644 --- a/base/conditions.lisp +++ b/base/conditions.lisp @@ -36,6 +36,12 @@ (define-condition clsql-simple-warning (simple-condition clsql-warning) ()) +(define-condition clsql-generic-error (clsql-error) + ((message :initarg :message + :reader clsql-generic-error-message)) + (:report (lambda (c stream) + (format stream (clsql-generic-error-message c))))) + (define-condition clsql-invalid-spec-error (clsql-error) ((connection-spec :initarg :connection-spec :reader clsql-invalid-spec-error-connection-spec) diff --git a/base/database.lisp b/base/database.lisp index 1c6fa63..62c6077 100644 --- a/base/database.lisp +++ b/base/database.lisp @@ -176,9 +176,24 @@ error should be signaled if the existing database connection cannot be closed. When non-nil (this is the default value) the connection is closed without error checking. When FORCE is nil, an error is signaled if the database connection has been lost." - ;; TODO: Support all backends. Perhaps integrate with pools - ;; Handle error and force keywords - (declare (ignore database error force))) + (let ((db (etypecase database + (database database) + ((or string list) + (let ((db (find-database database :errorp nil))) + (when (null db) + (if (and database errorp) + (error 'clsql-generic-error + :message + (format nil "Unable to find database with connection-spec ~A." database)) + (return-from reconnect nil))) + db))))) + + (when (is-database-open db) + (if force + (ignore-errors (disconnect db)) + (disconnect db :error nil))) + + (connect (connection-spec db)))) (defun status (&optional full) diff --git a/debian/changelog b/debian/changelog index 3e2a6bb..f09deac 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,7 +4,7 @@ cl-sql (2.7.3-1) unstable; urgency=low * Change depends (closes:243977) * Add new backend - -- Kevin M. Rosenberg Thu, 15 Apr 2004 17:13:52 -0600 + -- Kevin M. Rosenberg Fri, 16 Apr 2004 11:47:51 -0600 cl-sql (2.6.7-1) unstable; urgency=low -- 2.34.1