[postmodern-devel] Multirow inserts and transactions in postmodern
Harry Bock
harry at oshean.org
Wed Nov 12 03:40:56 UTC 2008
Hi again Marijn,
On Wed, 2008-11-12 at 00:42 +0100, Marijn Haverbeke wrote:
> This isn't currently supported by S-SQL. Feel free to propose a
> syntax. The current one (which tries to resemble UPDATE) is rather
> unsuitable for this. Maybe we could add a new operator.
> :insert-rows-into?
Creating a new operator sounds like a good idea. I've attached a patch
that implements the operator, let me know if it's good enough to apply
to your repo :)
It works like so:
(:insert-rows-into 'pg-table
:columns ('a 'b 'c)
:values ((1 2 3) (4 5 6)))
It does length-checking against the columns and values lists, allows
omission of the columns list, and includes RETURNING support.
> Yes, if you want the unwind-protect automatic cleanup you'll have to
> use with-transaction. You're free to just do (execute "begin"),
> (execute "commit") etcetera, of course.
Great, thanks :)
Regards,
Harry
> Cheers,
> Marijn
>
> _______________________________________________
> postmodern-devel mailing list
> postmodern-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel
--
Harry Bock
Software Developer, Package Maintainer
OSHEAN, Inc.
Email: harry at oshean.org
PGP Key ID: 546CC353
-------------- next part --------------
A non-text attachment was scrubbed...
Name: s-sql-insert-rows-into.patch
Type: text/x-patch
Size: 1264 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/postmodern-devel/attachments/20081111/ace2dea4/attachment.bin>
More information about the postmodern-devel
mailing list