[postmodern-devel] (:nextval a-symbol)
Lars Rune Nøstdal
larsnostdal at gmail.com
Mon Oct 13 20:24:55 UTC 2008
On Mon, 2008-10-13 at 15:40 +0200, Marijn Haverbeke wrote:
> > took me a while to figure out that only strings are supported
> > for :nextval in a :col-default context, so:
>
> Cool. Any reason you didn't patch the :nextval operator itself?
>
> Cheers,
> Marijn
..I think my last message got lost somewhere. This:
diff -rN -u old-postmodern/postmodern/util.lisp new-postmodern/postmodern/util.lisp
--- old-postmodern/postmodern/util.lisp 2008-10-13 22:24:03.000000000 +0200
+++ new-postmodern/postmodern/util.lisp 2008-10-13 22:24:03.000000000 +0200
@@ -9,7 +9,7 @@
(defun sequence-next (sequence)
"Shortcut for getting the next value from a sequence."
- (query (:select (:nextval (to-identifier sequence))) :single))
+ (query (:select (:nextval sequence)) :single))
(defmacro make-list-query (relkind)
"Helper macro for the functions that list tables, sequences, and
diff -rN -u old-postmodern/s-sql/s-sql.lisp new-postmodern/s-sql/s-sql.lisp
--- old-postmodern/s-sql/s-sql.lisp 2008-10-13 22:24:03.000000000 +0200
+++ new-postmodern/s-sql/s-sql.lisp 2008-10-13 22:24:03.000000000 +0200
@@ -684,6 +684,9 @@
(def-sql-op :drop-sequence (name)
`("DROP SEQUENCE " ,@(sql-expand name)))
+(def-sql-op :nextval (name)
+ `("nextval('" ,@(sql-expand name) "')"))
+
(def-sql-op :create-view (name query)
;; does not allow to specify the columns of the view yet
`("CREATE VIEW " ,(to-sql-name name) " AS " ,@(sql-expand query)))
..seems to work.
--
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