On a windows platform I have the following:
schema.sql
(contains the sql scripts) sqlite3.exe
(command shell for sqlite -> downloaded from sqlite.org) build.bat
: A batch file with the line : sqlite3.exe -init schema.sql default.db3
When I run build.bat, the database is created as expected, however, the sqlite shell doesn't automatically terminate. So how would I get the batch file to run and terminate the sqlite command shell automatically?
E.g. output:
C:\Work\X\Database>sqlite3.exe -init schema.sql default.db3
-- Loading resources from schema.sql
SQLite version 3.7.4
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
Open a command prompt (cmd.exe) and 'cd' to the folder location of the SQL_SAFI. sqlite database file. run the command 'sqlite3' This should open the SQLite shell and present a screen similar to that below.
SQLite allows multiple processes to have the database file open at once, and for multiple processes to read the database at once. When any process wants to write, it must lock the entire database file for the duration of its update. But that normally only takes a few milliseconds.
The biggest problem with using SQLite in production is disaster recovery. If your server dies, so does your data. That's… not good. Other database servers have replication so they can stream database changes to another server in case one goes down.
SQLite is the most widely deployed database in the world with more applications than we can count, including several high-profile projects. SQLite is a compact library. With all features enabled, the library size can be less than 750KiB, depending on the target platform and compiler optimization settings.
Try to call it like that:
echo .quit | sqlite3.exe
Or put .quit
in the end of your file.
It seems (since you haven't shown its contents) that the bat
file is missing the exit
statement. You can add it yourself:
sqlite3.exe -init schema.sql default.db3 .exit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With