On Fri, May 17, 2019 at 9:34 AM Tony Papadimitriou <to...@acm.org> wrote:
> 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’) > > type con | sqlite3 my.db insert into t values(‘simple field’,’multi-line text copied from some other app’) ctrl-z cat | sqlite3 my.db insert into t values(‘simple field’,’multi-line text copied from some other app’) ctrl-D > 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