-(defmacro defsqltable (tname &key fields)
- `(progn
- (defclass ,tname (sqltable)
- ,(parse-fields tname fields)
- ,(default-initargs fields))
-
- (defmethod sql-name ((self ,tname))
- ,(substitute #\_ #\- (write-to-string tname)))
-
- (defmethod fields ((self ,tname))
- (quote ,fields))
-
- (defmethod sql-cmd-create-table ((self ,tname))
- ,(create-table-string tname fields))
-
- (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))
- ))