Somehow I'd never noticed that. Great feature! On Fri, May 17, 2019 at 2:46 PM David Raymond <david.raym...@tomtom.com> wrote:
> Are you on an OS with a working edit() function? > https://www.sqlite.org/cli.html#the_edit_sql_function > > In Windows using notepad I can do this for example: > > insert into t values ('simple field', edit('<paste over this text when it > opens>', 'notepad')); > > You can even use it for multiple fields and it'll open one at a time > > insert into t (field1, field2) values (edit('This is for field1', > 'notepad'), edit('This is for field2', 'notepad')); > > > -----Original Message----- > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] > On Behalf Of Tony Papadimitriou > Sent: Friday, May 17, 2019 12:34 PM > To: SQLite mailing list > Subject: [sqlite] readfile() enhancement request > > It’s quite often (for me, at least) the case I need to do something like > this from the command line: > > >sqlite3.exe my.db “insert into t values(‘simple field’,’multi-line text > copied from some other app’) > > The problem is the multi-line text cannot be copy-pasted directly into the > command line as the first newline will terminate the command. So, I’ve > been using readline() like so: > > First, save the copied text into some arbitrary file (e.g., xxx), and then > do > > >sqlite3.exe my.db “insert into t values(‘simple field’,readfile(‘xxx’)) > > What would be much easier is for readfile to accept standard input when > provided with no empty name, > i.e., readfile(‘’). > > Then, it would read standard input (i.e., wait for me to type/paste my > text) until CTRL-Z/D. > > --- > >sqlite3.exe my.db “insert into t values(‘simple field’,readfile(‘’)) > My text typed/pasted here > ... > ... > CTRL-Z/D > --- > > This could also be used to capture directly into the db the output of some > other program without first having to save it to a file. > > I’m not sure how multiple readfile(‘’) on the same command should be > handled, either not allowed, or they all get a copy of the same input. > > Thanks. > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users