[sqlite] Interrupt SQL query in SHELL

2015-04-02 Thread Gert Van Assche
Ryan, Simon, thank you both for the help. The script works fine, and I now also understand how to use this bail mechanism. It is great! once more: THANK YOU! gert 2015-04-01 23:17 GMT+02:00 Simon Slavin : > > On 1 Apr 2015, at 8:09pm, Gert Van Assche wrote: > > > But this is definitely not

[sqlite] Interrupt SQL query in SHELL

2015-04-01 Thread R.Smith
On 2015-04-01 09:09 PM, Gert Van Assche wrote: > Dr. Hipp, thanks for the tip. I put > .bail on > in the script. > > > Ryan, I think I don't know how to trigger the bail out from within a SELECT > statement. > I tried > SELECT CASE (select count(*) from T1) WHEN (select count(*) from

[sqlite] Interrupt SQL query in SHELL

2015-04-01 Thread Simon Slavin
On 1 Apr 2015, at 8:09pm, Gert Van Assche wrote: > But this is definitely not the right way to do it. If I understand the doc > correctly, it should be an expression, but I don't see how I can do this... You can trigger a bail by causing any SQL error. For example, inserting a duplicate

[sqlite] Interrupt SQL query in SHELL

2015-04-01 Thread Gert Van Assche
Dr. Hipp, thanks for the tip. I put .bail on in the script. Ryan, I think I don't know how to trigger the bail out from within a SELECT statement. I tried SELECT CASE (select count(*) from T1) WHEN (select count(*) from T2) then 'OK' else RAISE(FAIL) END; But this is definitely not the

[sqlite] Interrupt SQL query in SHELL

2015-04-01 Thread R.Smith
On 2015-04-01 08:29 PM, Gert Van Assche wrote: > Hi all, > > When running SQLite3 from command line, is there a way to interrupt the CMD > file when a condition is true? > > I'm importing a lot of plain text files that should all count the same > number of lines, so I want to compare the record

[sqlite] Interrupt SQL query in SHELL

2015-04-01 Thread Gert Van Assche
Hi all, When running SQLite3 from command line, is there a way to interrupt the CMD file when a condition is true? I'm importing a lot of plain text files that should all count the same number of lines, so I want to compare the record count of all imported data with the first file that was

[sqlite] Interrupt SQL query in SHELL

2015-04-01 Thread Richard Hipp
On 4/1/15, Gert Van Assche wrote: > > My question is: when the import fails (detected in the script.sql file), I > would like to stop executing the batch file (runscript.cmd). > > Is there a way to do so? > Have you tried the -bail command-line option? -- D. Richard Hipp drh at sqlite.org