[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] DBI
From: |
Alaric Snell-Pym |
Subject: |
Re: [Chicken-users] DBI |
Date: |
Thu, 28 Feb 2008 11:50:33 +0000 |
dbi:query-fold, dbi:query-map, query-for-each. I thought about
implementing these, but I
haven't been able to think of the use case that makes them
necessary in the presence
Scheme's fold, map, and for-each, other than as shorthand (which
could be define'd
in place in a heartbeat for anyone who wants it)
Result streaming. You want to avoid having a query function that
returns a list of rows, where possible, because some DB APIs will let
you stream rows from the server as you consume them.
For a million row result, being able to stream them from the server
into a function that converts them to HTML and streams them out to a
browser, or whatever, is a big save in server memory :-)
Ideally, have your query function return a proper *stream* of conses
with promises in, then use existing stream fold/map/filter on them,
of course. Vague memory there's an SRFI for that, but I've never had
the need to look it up in detail.
dbi:insert-id Should this come from a function, or should it be
returned as a response to
dbi:query? I wouldn't mind seeing the query handler be smart
enough that if my query
involves INSERT and i've inserted a row that becomes ID 42, that
the response would
be something like '((rows-affected 1) (insert-id 42)) Certainly,
we'd want to look at what
we'd want to normalize these labels to, but that's not a huge issue.
The related question is whether singleton response values (like
rows-affected with
nothing else) should return as a singleton (a)list or as a numeric
value --> My vote would
be to return the singleton (a)list to simplify the conditional
checking the caller needs
to use.
In my past I've preferred to have "query" procedures for SQL queries,
and "execute" procedures for INSERT et al, which don't return a
table, just success/failure. Then you can have a more specific
procedure for "insert" that returns inserted ID metadata.
ABS
--
Alaric Snell-Pym
Work: http://www.snell-systems.co.uk/
Play: http://www.snell-pym.org.uk/alaric/
Blog: http://www.snell-pym.org.uk/?author=4
- Re: [Chicken-users] DBI, (continued)
- Re: [Chicken-users] DBI, Tobia Conforto, 2008/02/29
- Re: [Chicken-users] DBI, Graham Fawcett, 2008/02/27
- Re: [Chicken-users] DBI, Vincent Manis, 2008/02/27
- Re: [Chicken-users] DBI, Peter Bex, 2008/02/28
- Re: [Chicken-users] DBI, Graham Fawcett, 2008/02/28
- Re: [Chicken-users] DBI, Peter Bex, 2008/02/28
- Re: [Chicken-users] DBI, Graham Fawcett, 2008/02/28
- Re: [Chicken-users] DBI, Peter Bex, 2008/02/28
- Re: [Chicken-users] DBI, Graham Fawcett, 2008/02/28
- Re: [Chicken-users] DBI, Ozzi Lee, 2008/02/27
- Re: [Chicken-users] DBI,
Alaric Snell-Pym <=
Re: [Chicken-users] DBI, Vincent Manis, 2008/02/27
Re: argument against using '() for null values? ([Chicken-users] DBI), Ozzi, 2008/02/27
Re: argument against using '() for null values? ([Chicken-users] DBI), Graham Fawcett, 2008/02/27
Re: argument against using '() for null values? ([Chicken-users] DBI), Ozzi, 2008/02/27
Re: argument against using '() for null values? ([Chicken-users] DBI), Graham Fawcett, 2008/02/27
Re: argument against using '() for null values? ([Chicken-users] DBI), Ozzi, 2008/02/27
Re: argument against using '() for null values? ([Chicken-users] DBI), Graham Fawcett, 2008/02/28