r9034: Automated commit for Debian build of clsql upstream-version-2.7.3
authorKevin M. Rosenberg <kevin@rosenberg.net>
Fri, 16 Apr 2004 17:50:35 +0000 (17:50 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Fri, 16 Apr 2004 17:50:35 +0000 (17:50 +0000)
ChangeLog
base/conditions.lisp
base/database.lisp
debian/changelog

index bd0530edc6c8b40fcd916e0ec7a85b0f06173071..b186b5ad17f7869e054daf8468eeae7cdc2be750 100644 (file)
--- 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
 
index a84f6546d0c95c2f815f0917154d5e2ddb889631..81a1226bfe48b02a2fbf1456f4bf3ed210303726 100644 (file)
 (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)
index 1c6fa63ee82fc12911175575a755470b3e8854aa..62c6077d313ac7684e8debfd7b209da31a7d6b89 100644 (file)
@@ -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)
index 3e2a6bb992bdb45977ae862cd63dec32f429d90d..f09deac2ca7d78c7c616d69249ea0a10cef884fa 100644 (file)
@@ -4,7 +4,7 @@ cl-sql (2.7.3-1) unstable; urgency=low
   * Change depends (closes:243977)
   * Add new backend
 
- -- Kevin M. Rosenberg <kmr@debian.org>  Thu, 15 Apr 2004 17:13:52 -0600
+ -- Kevin M. Rosenberg <kmr@debian.org>  Fri, 16 Apr 2004 11:47:51 -0600
 
 cl-sql (2.6.7-1) unstable; urgency=low