X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql%2Ffddl.lisp;h=2c28ab2bc212884195c2059cc141cbf6d89f3023;hb=e336ab9b5b48fe3f28737386eded4c8f897e25f6;hp=50fe159c2622f0836b01a95b7fcdf9286bcedc6d;hpb=d2d49ab13c98bc7a1819a0fd3968268a5567bdc3;p=clsql.git diff --git a/sql/fddl.lisp b/sql/fddl.lisp index 50fe159..2c28ab2 100644 --- a/sql/fddl.lisp +++ b/sql/fddl.lisp @@ -111,6 +111,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 @@ -118,10 +125,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 @@ -431,7 +435,7 @@ sequences are examined." (defun set-sequence-position (name position &key (database *default-database*)) "Explicitly set the the position of the sequence called NAME in -DATABASE, which defaults to *DEFAULT-DATABSE*, to POSITION which +DATABASE, which defaults to *DEFAULT-DATABASE*, to POSITION which is returned." (database-set-sequence-position (database-identifier name database) position database))