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: Fwd: World's simplest Scheme interface to sqlite3 Alaric Snell-Pym 31 Aug 2020 22:03 UTC

On 29/08/2020 23:36, John Cowan wrote:

> -table-names and -column-names can be done with ordinary SQL (by
>> querying magic SQLite-only tables). Do they need their own procedures?
>>
>
> Yes, if we ever hope to be portable off SQLite.  Providing them means that
> dynamic SQL can be constructed readily.  For example, you could have an
> application with a UI form where the user indicates the columns they want
> to use to populate a table of data.  The programmer would use
> sqlite-column-names to populate the form, and then specify a SQL statement
> like "SELECT ?cols FROM table".  By providing a list of the chosen column
> names (as symbols) as the "cols" argument, the statement will be correctly
> created with no risk of injection attacks from bogus column names.  And now
> you see why SQLite ?s are not enough.

An even more mainstream (and arguably important) use for these is in
automatic schema migration; if your application, upon opening a database
file, checks to see what tables and columns exist, it can add any that
are missing. This enables:

1) When creating a new file, the application will fill it with empty
tables so that subsequent inserts will work.

2) When V2 of your app opens a file created with V1, it will upgrade the
schema (in a way that, if your app is carefully written, will not
prevent the file being opened by V1 again, too, but that's a separate
issue!) so that V2 queries will work.

--
Alaric Snell-Pym   (M7KIT)
http://www.snell-pym.org.uk/alaric/