X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql%2Ftable.lisp;h=4fb91685eff5e690b08ca954e33d3bab4c9d4f7b;hb=150e23be29d88d99e4114a8cff017b3cce005e10;hp=715cef0199c619a84da3b566fb4e4efd5fbea4fc;hpb=7f0e4a65d1b425f2fa58fc7cce8296c1a6c52c2f;p=clsql.git diff --git a/sql/table.lisp b/sql/table.lisp index 715cef0..4fb9168 100644 --- a/sql/table.lisp +++ b/sql/table.lisp @@ -1,20 +1,21 @@ ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- -;;;; ====================================================================== -;;;; File: table.lisp -;;;; Updated: <04/04/2004 12:05:03 marcusp> -;;;; ====================================================================== +;;;; ************************************************************************* ;;;; -;;;; Description ========================================================== -;;;; ====================================================================== +;;;; $Id$ ;;;; -;;;; The CLSQL-USQL Functional Data Definition Language (FDDL) +;;;; The CLSQL Functional Data Definition Language (FDDL) ;;;; including functions for schema manipulation. Currently supported ;;;; SQL objects include tables, views, indexes, attributes and ;;;; sequences. ;;;; -;;;; ====================================================================== +;;;; This file is part of CLSQL. +;;;; +;;;; CLSQL users are granted the rights to distribute and use this software +;;;; as governed by the terms of the Lisp Lesser GNU Public License +;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. +;;;; ************************************************************************* -(in-package :clsql-usql-sys) +(in-package #:clsql-sys) ;; Utilities @@ -31,9 +32,6 @@ ;; Tables -(defvar *table-schemas* (make-hash-table :test #'equal) - "Hash of schema name to table lists.") - (defun create-table (name description &key (database *default-database*) (constraints nil)) "Create a table called NAME, in DATABASE which defaults to @@ -47,8 +45,6 @@ a list containing lists of attribute-name and type information pairs." :name table-name :columns description :modifiers constraints))) - (pushnew table-name (gethash *default-schema* *table-schemas*) - :test #'equal) (execute-command stmt :database database))) (defun drop-table (name &key (if-does-not-exist :error) @@ -91,9 +87,6 @@ returned as a list of strings." ;; Views -(defvar *view-schemas* (make-hash-table :test #'equal) - "Hash of schema name to view lists.") - (defun create-view (name &key as column-list (with-check-option nil) (database *default-database*)) "Creates a view called NAME using the AS query and the optional @@ -110,7 +103,6 @@ is NIL. The default value of DATABASE is *DEFAULT-DATABASE*." :column-list column-list :query as :with-check-option with-check-option))) - (pushnew view-name (gethash *default-schema* *view-schemas*) :test #'equal) (execute-command stmt :database database))) (defun drop-view (name &key (if-does-not-exist :error) @@ -152,9 +144,6 @@ of strings." ;; Indexes -(defvar *index-schemas* (make-hash-table :test #'equal) - "Hash of schema name to index lists.") - (defun create-index (name &key on (unique nil) attributes (database *default-database*)) "Creates an index called NAME on the table specified by ON. The @@ -168,7 +157,6 @@ UNIQUE is nil. The default value of DATABASE is *DEFAULT-DATABASE*." (stmt (format nil "CREATE ~A INDEX ~A ON ~A (~{~A~^, ~})" (if unique "UNIQUE" "") index-name table-name attributes))) - (pushnew index-name (gethash *default-schema* *index-schemas*)) (execute-command stmt :database database))) (defun drop-index (name &key (if-does-not-exist :error) @@ -261,16 +249,11 @@ is the vendor-specific type returned by ATTRIBUTE-TYPE." ;; Sequences -(defvar *sequence-schemas* (make-hash-table :test #'equal) - "Hash of schema name to sequence lists.") - (defun create-sequence (name &key (database *default-database*)) "Create a sequence called NAME in DATABASE which defaults to *DEFAULT-DATABASE*." (let ((sequence-name (database-identifier name))) - (database-create-sequence sequence-name database) - (pushnew sequence-name (gethash *default-schema* *sequence-schemas*) - :test #'equal)) + (database-create-sequence sequence-name database)) (values)) (defun drop-sequence (name &key (if-does-not-exist :error) @@ -317,4 +300,4 @@ POSITION." (defun sequence-last (name &key (database *default-database*)) "Return the last value of the sequence NAME in DATABASE." - (database-sequence-last (database-identifier name) database)) \ No newline at end of file + (database-sequence-last (database-identifier name) database))