I know of the reluctance among the SQLite programmers to add features to the 
intentionally 'lite' product, but I am coming to the conclusion that having 
this feature in the standard code base will be of great convenience to a lot of 
users.

I would like the introduction of a command which changes a SELECT the same way 
EXPLAIN QUERY PLAN changes a SELECT.  This one should take the SELECT and 
instead of producing a table, sometimes with many columns, produces a 1 column 
table with the SELECTed data shown as INSERT commands, with values correctly 
single-quoted where necessary.

The simplest implementation, and possibly all that's needed, would be one which 
works only on 'SELECT *' with no JOINs.  It should pay attention to 'WHERE', 
'ORDER BY', 'GROUP BY', LIMIT and OFFSET.

The next complication up would be to allow the selection of certain fields in a 
specific order rather than working only for '*'.

One proposal for syntax would be to prefix the SELECT statement with 'LIST 
INSERTS FOR '.

Alternatively a completely different syntax could be used which looks nothing 
like a SELECT statement, one where you had to specify a table, and could 
optionally specify a list of columns, something like

LIST INSERTS FOR myTable FOR COLUMNS *
LIST INSERTS FOR myTable FOR COLUMNS (id, player, team, time)

which didn't have a way of specifying any SELECT clauses.

What does the team think ?  Are any of you familiar with ways other SQL engines 
do this ?

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to