SQLite Forum

SQLite3.exe - How to use arguments AND remain in interactive mode?
Login
`-interactive` and `-batch` probably do not do what you think they do.

In all cases, the CLI "reads" its input from STDIN

`-interactive` means that an ugly-bag-of-mostly-water may be providing the STDIN input stream and hence "prompts" should be provided to awaken the water-bag from time to time.

`-batch` means that the STDIN input stream is attached to a source other than an ugly-bag-of-mostly-water and that "prompts" are not required to spur the water-bag to send the next command.

```
2021-08-07 14:40:38 PY64 3.9 [D:\work\covid]
>sqlite3 -interactive cases.db
-- Loading resources from C:\Users\KMedcalf/.sqliterc
SQLite version 3.37.0 2021-08-06 23:38:02
Enter ".help" for usage hints.
sqlite> .mode list
sqlite> select * from provcasedays where days == 7 and province == 'ab';
Location|Date|Tests|Cases|Recovered|ChgActive|ChgHosp|ChgICU|ChgDeath|TtlDeath|NetActive|NetHosp|NetICU|NetDeath|SNetActive|SChgActive|SNetHosp|SNetICU|SNetDeath|Rs
AB|2021-07-30|8293|187|49|135|1|-1|3|2342|1567|90|20|3|1457|153|88|21|1|1.46
AB|2021-07-31|0|0|0|0|0|0|0|2342|1567|90|20|0|1590|133|89|21|1|1.47
AB|2021-08-01|0|0|0|0|0|0|0|2342|1567|90|20|0|1741|150|91|21|0|1.48
AB|2021-08-02|0|0|0|0|0|0|0|2342|1567|90|20|0|1855|144|93|22|1|1.48
AB|2021-08-03|21609|743|222|521|0|4|0|2342|2088|90|24|0|1971|174|94|23|0|1.48
AB|2021-08-04|5419|206|100|106|7|0|0|2342|2194|97|24|0|2240|290|96|24|0|1.48
AB|2021-08-05|7461|397|152|244|5|1|1|2343|2438|102|25|1|2438|244|102|25|1|1.48
sqlite> ^Z



2021-08-07 14:42:46 PY64 3.9 [D:\work\covid]
>sqlite3 -batch cases.db
.mode list
select * from provcasedays where days == 7 and province == 'ab';
Location|Date|Tests|Cases|Recovered|ChgActive|ChgHosp|ChgICU|ChgDeath|TtlDeath|NetActive|NetHosp|NetICU|NetDeath|SNetActive|SChgActive|SNetHosp|SNetICU|SNetDeath|Rs
AB|2021-07-30|8293|187|49|135|1|-1|3|2342|1567|90|20|3|1457|153|88|21|1|1.46
AB|2021-07-31|0|0|0|0|0|0|0|2342|1567|90|20|0|1590|133|89|21|1|1.47
AB|2021-08-01|0|0|0|0|0|0|0|2342|1567|90|20|0|1741|150|91|21|0|1.48
AB|2021-08-02|0|0|0|0|0|0|0|2342|1567|90|20|0|1855|144|93|22|1|1.48
AB|2021-08-03|21609|743|222|521|0|4|0|2342|2088|90|24|0|1971|174|94|23|0|1.48
AB|2021-08-04|5419|206|100|106|7|0|0|2342|2194|97|24|0|2240|290|96|24|0|1.48
AB|2021-08-05|7461|397|152|244|5|1|1|2343|2438|102|25|1|2438|244|102|25|1|1.48
^Z
```

-batch and -interactive also have an effect on error handling.  Obviously, the ugly-bag-of-mostly-water cannot intervene if the bag is not present (-batch), but if it is (-interactive) then the bag can whammo the ^C and ^Z to get out of here.