[postmodern-devel] (:nextval a-symbol)

Lars Rune Nøstdal larsnostdal at gmail.com
Mon Oct 13 12:15:21 UTC 2008


took me a while to figure out that only strings are supported
for :nextval in a :col-default context, so:

        lnostdal at blackbox:~/programming/lisp/postmodern/postmodern$ darcs diff -u
        diff -rN -u old-postmodern/postmodern/table.lisp new-postmodern/postmodern/table.lisp
        --- old-postmodern/postmodern/table.lisp	2008-10-13 14:11:29.000000000 +0200
        +++ new-postmodern/postmodern/table.lisp	2008-10-13 14:11:29.000000000 +0200
        @@ -293,6 +293,10 @@
                            ,(loop :for slot :in (dao-column-slots table)
                                   :collect `(,(slot-definition-name slot) :type ,(column-type slot)
                                              ,@(when (slot-boundp slot 'col-default)
        -                                             `(:default ,(column-default slot)))))
        +                                             `(:default ,(let ((col-def (column-default slot)))
        +                                                           (when (eq :nextval (first col-def))
        +                                                             (setf (second col-def)
        +                                                                   (to-identifier (second col-def))))
        +                                                           col-def)))))
                            ,@(when (dao-keys table)
                                `((:primary-key ,@(dao-keys table)))))))


..then..

        (defclass user ()
          ((id :col-type integer :reader id-of :col-default (:nextval user-id-seq))
           ...))


..i don't know.


-- 
Lars Rune Nøstdal   || AJAX/Comet GUI type stuff for Common Lisp
http://nostdal.org/ || http://groups.google.com/group/symbolicweb






More information about the postmodern-devel mailing list