;; 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
: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)
;; 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
: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)
;; 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
(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)
;; 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)