r9186: add attribute caching, improve inititialize-database-type
[clsql.git] / base / database.lisp
index 953c40a3bc51779d74b4375a2292f04ea59c97f5..f3c72b65a2ead44ab85a414296ee959cbad6d2cb 100644 (file)
@@ -85,6 +85,9 @@ to the new connection, otherwise *default-database is not changed. If
 pool is t the connection will be taken from the general pool, if pool
 is a conn-pool object the connection will be taken from this pool."
 
+  (unless database-type
+    (error "Must specify a database-type."))
+  
   (when (stringp connection-spec)
     (setq connection-spec (string-to-list-connection-spec connection-spec)))
   
@@ -181,7 +184,7 @@ if the database connection has been lost."
              ((or string list)
               (let ((db (find-database database :errorp nil)))
                 (when (null db)
-                  (if (and database errorp)
+                  (if (and database error)
                       (error 'clsql-generic-error
                              :message
                              (format nil "Unable to find database with connection-spec ~A." database))
@@ -246,6 +249,10 @@ of full is NIL."
     (setq connection-spec (string-to-list-connection-spec connection-spec)))
   (database-destroy connection-spec database-type))
 
+(defun list-databases (connection-spec &key database-type)
+  (when (stringp connection-spec)
+    (setq connection-spec (string-to-list-connection-spec connection-spec)))
+  (database-list connection-spec database-type))
 
 (defmacro with-database ((db-var connection-spec &rest connect-args) &body body)
   "Evaluate the body in an environment, where `db-var' is bound to the