X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=base%2Fdatabase.lisp;h=92599bb83075be8f92db89df5b42f5d21e9d219a;hb=e5744a78271044484b3399d4fc1d55b3e8808784;hp=78b6faafa2867d7846eeef96675b06e8e0e4d3e1;hpb=d68d59f99911564ac2af867561fefef107cb14e8;p=clsql.git diff --git a/base/database.lisp b/base/database.lisp index 78b6faa..92599bb 100644 --- a/base/database.lisp +++ b/base/database.lisp @@ -81,6 +81,10 @@ connection. If make-default is true, then *default-database* is set 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." + + (when (stringp connection-spec) + (setq connection-spec (string-to-list-connection-spec connection-spec))) + (if pool (acquire-from-pool connection-spec database-type pool) (let* ((db-name (database-name-from-spec connection-spec database-type)) @@ -202,6 +206,21 @@ of full is NIL." (print-separator total-size)))) (values))) +(defun create-database (connection-spec &key database-type) + (when (stringp connection-spec) + (setq connection-spec (string-to-list-connection-spec connection-spec))) + (database-create connection-spec database-type)) + +(defun probe-database (connection-spec &key database-type) + (when (stringp connection-spec) + (setq connection-spec (string-to-list-connection-spec connection-spec))) + (database-probe connection-spec database-type)) + +(defun destroy-database (connection-spec &key database-type) + (when (stringp connection-spec) + (setq connection-spec (string-to-list-connection-spec connection-spec))) + (database-destroy 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 @@ -223,3 +242,4 @@ The connection is automatically closed or released to the pool on exit from the `(progv '(*default-database*) (list ,database) ,@body)) +