Yes, Richard, this is exactly what I mean. Roman ________________________________________ From: sqlite-users [sqlite-users-boun...@mailinglists.sqlite.org] on behalf of Richard Hipp [d...@sqlite.org] Sent: Wednesday, January 11, 2017 4:34 PM To: SQLite mailing list Subject: Re: [sqlite] extension to run bash
On 1/11/17, Roman Fleysher <roman.fleys...@einstein.yu.edu> wrote: > Dear SQLites, > > I am using exclusively sqlite3 shell for all the processing and may need > ability to run bash commands and assign result to a column. For example: > > UPDATE result SET nRows =` wc -l fileNames` ; > > Here I used `` as would be in bash for command substitution. This would run > wc command (word count), count number of lines in each file listed in column > fileNames and update the row correspondingly. > > As far as I understand I should be able to write loadable extension to > accomplish this. No, You cannot do exactly what you describe with a loadable extension. But you could, perhaps, create a loadable extension that implements a new system() SQL function like this: UPDATE result SET nRows = system('wc -l ' || fileNames); Note that || is the SQL string concatenation operator. You didn't say, but I'm guessing that fileNames is a column in the result table. -- D. Richard Hipp d...@sqlite.org _______________________________________________ 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