I have written a socket-level interface to PostgreSQL for scsh (a
Scheme implementation with POSIX extensions, a module system,
exception handling and other useful features for systems programming).
The module is capable of type coercions from a range of SQL types to
the equivalent Scheme type. It currently supports neither crypt or
Kerberos authentication, nor large objects.
Unfortunately I implemented the v6.3 protocol, but I will update it
for v6.4 shortly. Please send bug reports, suggestions and questions to
<emarsden@mail.dotcom.fr>. This is version 0.1, the first release.
The code is available under LGPL from
<URL:http://www.chez.com/emarsden/downloads/pgscsh-0.1.tar.gz>
Here is a taste of the API:
(define (demo)
(let* ((conn (pg:connect "template1" "postgres" "postgres"))
(res (pg:exec conn "SELECT * from scshdemo WHERE a = 42")))
(format #t "status is ~s~%" (pg:result res 'status))
(format #t "metadata is ~s~%" (pg:result res 'attributes))
(format #t "data is ~s~%" (pg:result res 'tuples))
(pg:disconnect conn)))
[More information about scsh at <URL:http://www-swiss.ai.mit.edu/scsh/>,
and about Scheme at <URL:http://www.schemers.org/>. I also have a
version for CLISP, a space-efficient implementation of Common Lisp,
in the works, and am thinking about a version for Emacs.]
--
Eric Marsden
emarsden @ mail.dotcom.fr
It's elephants all the way down