You are looking at historical revision 9071 of this page. It may differ significantly from its current revision.

Database Interface Discussion

Proposed Interface

<procedure>(dbi
connect TYPE #!key FILE PORT USER PASS etc)</procedure> : Connect to a database. TYPE is a symbol, like mysql, postgres, sqlite, etc. Returns a connection object.
<procedure>(dbi
query CONNECTION SQL)</procedure> : Query the database (see the mysql egg)
<procedure>(dbi
num-rows CONNECTION)</procedure> : Return the number of rows produced by the last query (see mysql)
<procedure>(dbi
fetch-row CONNECTION)</procedure> : Return the next row (see mysql).
<procedure>(dbi
query-fold CONNECTION PROC SQL SEED)</procedure> : fold
<procedure>(dbi
query-map CONNECTION PROC SQL)</procedure> : map
<procedure>(dbi
query-for-each CONNECTION PROC SQL SEED)</procedure> : for-each
<procedure>(dbi
insert-id CONNECTION)</procedure> : Returns the ID generated by the last insert statement.

Instead of the query-fold, query-map and query-for-each procedures I'd prefer just returning a SRFI-40/SRFI-41 stream using promises that advance the cursor when forced. This way you don't restrict the user to these three procedures, but he can use the full stream library to iterate over the result set. -- Peter Bex

Open issues

Row Representation

How are rows returned from a query represented?

Ozzi proposes either an association list or a plain list.

Null Representation

How are null values represented?