World's simplest Scheme interface to sqlite3 John Cowan (29 Aug 2020 03:00 UTC)
(missing)
(missing)
Fwd: World's simplest Scheme interface to sqlite3 John Cowan (29 Aug 2020 17:57 UTC)
Re: Fwd: World's simplest Scheme interface to sqlite3 Lassi Kortela (29 Aug 2020 18:44 UTC)
Re: Fwd: World's simplest Scheme interface to sqlite3 John Cowan (29 Aug 2020 22:37 UTC)
SQL API sketch with some code Lassi Kortela (30 Aug 2020 13:24 UTC)
Re: SQL API sketch with some code Lassi Kortela (30 Aug 2020 13:46 UTC)
Re: SQL API sketch with some code John Cowan (30 Aug 2020 20:47 UTC)
Re: SQL API sketch with some code Lassi Kortela (31 Aug 2020 05:02 UTC)
Re: SQL API sketch with some code Lassi Kortela (31 Aug 2020 05:14 UTC)
Re: SQL API sketch with some code John Cowan (31 Aug 2020 15:38 UTC)
Re: SQL API sketch with some code Lassi Kortela (31 Aug 2020 15:54 UTC)
Re: SQL API sketch with some code John Cowan (31 Aug 2020 17:12 UTC)
Re: SQL API sketch with some code Lassi Kortela (31 Aug 2020 19:20 UTC)
Reflection on the database schema Lassi Kortela (30 Aug 2020 13:35 UTC)
Re: Reflection on the database schema John Cowan (30 Aug 2020 19:51 UTC)
Re: Fwd: World's simplest Scheme interface to sqlite3 Alaric Snell-Pym (31 Aug 2020 22:03 UTC)
Re: Fwd: World's simplest Scheme interface to sqlite3 Lassi Kortela (02 Sep 2020 08:38 UTC)
Re: Fwd: World's simplest Scheme interface to sqlite3 John Cowan (02 Sep 2020 17:09 UTC)
SQL statement caching Lassi Kortela (02 Sep 2020 17:21 UTC)
Re: SQL statement caching John Cowan (02 Sep 2020 18:13 UTC)
Re: SQL statement caching Lassi Kortela (02 Sep 2020 18:53 UTC)
Re: World's simplest Scheme interface to sqlite3 Lassi Kortela (29 Aug 2020 11:40 UTC)
Re: World's simplest Scheme interface to sqlite3 Ivan Raikov (29 Aug 2020 04:06 UTC)
Re: World's simplest Scheme interface to sqlite3 Lassi Kortela (29 Aug 2020 11:24 UTC)
Re: World's simplest Scheme interface to sqlite3 John Cowan (29 Aug 2020 17:47 UTC)
Re: World's simplest Scheme interface to sqlite3 Lassi Kortela (29 Aug 2020 18:23 UTC)
Re: World's simplest Scheme interface to sqlite3 John Cowan (29 Aug 2020 22:15 UTC)
Re: World's simplest Scheme interface to sqlite3 Amirouche Boubekki (29 Aug 2020 07:33 UTC)
Re: World's simplest Scheme interface to sqlite3 Lassi Kortela (29 Aug 2020 11:37 UTC)

Re: World's simplest Scheme interface to sqlite3 Lassi Kortela 29 Aug 2020 11:36 UTC

> https://www-sop.inria.fr/mimosa/fp/Bigloo/doc/bigloo-19.html
>
> Here's all it has:
>
> 1) Open a database.
> 2) Close a database.
> 3) Format a string to escape it properly (would need some changes)
> 4) Execute a SQL command, auto-formatting the command string
> with arguments, returns one value
> 5) Evaluate a SQL statement (not clear how these are different)
> 6) Evaluate a SQL statement, map a Scheme proc over the values and
> return a list.
>
> You think this would make sense as a SRFI, just to get some easy and
> cheap persistence into Scheme?

An SRFI at this level of complexity would probably make sense, yes.

I would leave out the string formatting. Building SQL by hand leads to
hard-to-read and bug-prone code, and bugs can turn into SQL injection.
Better to rely on prepared statements for all parameterization. There
may be some advanced stuff (reflection on the structure of tables) that
requires SQL constructed in Scheme, but since this is the simple SRFI I
would just leave it out.

This ought to be enough for a minimal interface:

database-open     string . alist => database
database-execute  database string . alist => row-generator
database-close    database

Where alist is a list of (string . object) pairs. For `database-open`,
maybe (string . string) pairs.

Have Amirouche's tuple store and key-value store interfaces been
implemented for SQLite?