X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql%2Ffddl.lisp;h=0770dc5441ae268ff4d0899776908cd68b0f244a;hb=a5eb71537ba68b002a54752f484b23306aa0761f;hp=47323c344612b8711e175fb3c2962fba88293a0f;hpb=5ed1f05543cbd24b3f2bb735f2cfc03ea85e51ec;p=clsql.git diff --git a/sql/fddl.lisp b/sql/fddl.lisp index 47323c3..0770dc5 100644 --- a/sql/fddl.lisp +++ b/sql/fddl.lisp @@ -113,6 +113,13 @@ is a string denoting a user name, only tables owned by OWNER are listed. If OWNER is :all then all tables are listed." (database-list-tables database :owner owner)) +(defmethod %table-exists-p (name (database T) &key owner ) + (unless database (setf database *default-database*)) + (let ((name (database-identifier name database)) + (tables (list-tables :owner owner :database database))) + (when (member name tables :test #'string-equal) + t))) + (defun table-exists-p (name &key (owner nil) (database *default-database*)) "Tests for the existence of an SQL table called NAME in DATABASE which defaults to *DEFAULT-DATABASE*. OWNER is nil by default @@ -120,10 +127,7 @@ which means that only tables owned by users are examined. If OWNER is a string denoting a user name, only tables owned by OWNER are examined. If OWNER is :all then all tables are examined." - (when (member (database-identifier name database) - (list-tables :owner owner :database database) - :test #'string-equal) - t)) + (%table-exists-p name database :owner owner)) ;; Views