- (defmethod sql-cmd-create-indices ((self ,tname))
- "Return a list of index cmds"
- (quote ,(create-indices-string tname fields)))
-
- (defmethod sql-cmd-drop-table ((self ,tname))
- ,(format nil "DROP TABLE ~a" tname))
-
- (defmethod sql-cmd-field-names ((self ,tname))
- ,(row-field-string fields))
-
- (defmethod inverse-field-name ((self ,tname))
- ,(inverse-field-string fields))
- ))
-
-(defun create-indices-string (table-name fields)
- (let (indices)
- (dolist (field fields)
- (let ((name-string (write-to-string (car field))))
- (with-key-value-list (key value (rest field))
- (when (eq key :unique)
- (case value
- (nil
- (push (sql-cmd-index table-name name-string nil) indices))
- (t
- (push (sql-cmd-index table-name name-string t) indices)))))))
- indices))