Source
(defun open-schema-table (pathname &key if-exists if-does-not-exist)
;; Load existing schemas from the file.
(if (probe-file pathname)
(ecase if-exists
(:error (error "Schema table file ~S already exists." pathname))
(:supersede
;; Create an empty schema table, save it and return it.
(let ((table (make-instance 'schema-table :pathname pathname)))
(save-schema-table table)
table))
(:overwrite
;; Normal case
(let ((table (first (load-objects pathname))))
(when (not (equal pathname (schema-table-pathname table)))
;; The table was moved; update the pathname info.
(setf (schema-table-pathname table) pathname)
(save-schema-table table))
table)))
(ecase if-does-not-exist
(:error (error "Schema table file ~S does not exist." pathname))
(:create
;; Create an empty schema table, save it and return it.
(let ((table (make-instance 'schema-table :pathname pathname)))
(save-schema-table table)
table)))))
Source Context