[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Postgresql egg - usage for mortals?
From: |
Peter Bex |
Subject: |
Re: [Chicken-users] Postgresql egg - usage for mortals? |
Date: |
Mon, 19 Mar 2012 09:13:02 +0100 |
User-agent: |
Mutt/1.4.2.3i |
On Sun, Mar 18, 2012 at 11:42:44PM -0700, Matt Welland wrote:
> How do I do the equivalent of pg:query-for-each with the new api? It must
> be simple but I am confused. Any kind soul willing to point me in the right
> direction?
I'm not 100% sure what the old procedure did again, but this is probably
what you want:
(row-for-each*
(lambda (a b c)
(printf "Got a = ~A, b = ~A, c = ~A\n" a b c))
(query conn "SELECT a, b, c FROM foo"))
If you prefer to get the arguments in a list, use the version
without a star:
(row-for-each
(lambda (tuple)
(printf "Got tuple = ~A\n" tuple))
(query conn "SELECT a, b, c FROM foo"))
If the docs are unclear, I'd appreciate it if you can help me to
improve them.
Cheers,
Peter
--
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
is especially attractive, not only because it can be economically
and scientifically rewarding, but also because it can be an aesthetic
experience much like composing poetry or music."
-- Donald Knuth