[postmodern-devel] darcs patch: add support for the currval() and lastval() functions

Nicolas Martyanoff khaelin at gmail.com
Sun Aug 30 17:55:28 UTC 2009


On 09-08-30 19:39, Marijn Haverbeke wrote:
> Hi,
> 
> You'll notice that, even without your patch, something like (:currval
> "foo") expands to currval('foo') -- it's just a function, and when no
> special syntax is defined for a keyword, S-SQL will expand it as a
> function. Given this, does the patch still serve a purpose?

I don't know if I do it correctly, but without my patch:
    * (s-sql:sql-compile '(:select (:currval players_id_seq)))

    "(SELECT currval(players_id_seq))"

With my patch:
    * (s-sql:sql-compile '(:select (:currval players_id_seq)))

    "(SELECT currval(E'players_id_seq'))"

It seems that the default function expansion doesn't escape object names.

Since I'm here, note that there's also a setval() function, a bit more complex
since it takes arguments (two or three), but I didn't figure how to add it
(sorry, lisp beginner here). I'll try to add it... one day.

Regards,

-- 
Nicolas Martyanoff
   http://codemore.org
   khaelin at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/postmodern-devel/attachments/20090830/78b5d25a/attachment.sig>


More information about the postmodern-devel mailing list