On 11/05/2015 14:00, Clemens Ladisch wrote:
> Isn't the query itself passed through the command line?  Show some example.


In my case script is like this:
#!/bin/sh
(cat $1 && echo ";") | sqlite3 my-db.sqlite

Command to run it:
./my-sql-run sqls/my-query.sql

I need to pass some parameter, like "select * from table where 
kind=%%MYPARAM%%"

Currently one choice is to add my own shell code to modify the query on 
the fly, and to substitute %%MYPARAM%% with the argument passed to the 
shell script. But I think it would be easier if sqlite3 command itself 
could bind parameters. If sql could contain "kind=?", and sqlite3 could 
have for example --bind command to bind supplied values. Especially so 
if to consider that sqlite already supports prepared statements and binding.

Yuri

Reply via email to