SQLite Forum

-[no]create -- shell tool feature request/offer
Login
Often, when I start the SQLite shell tool, I know that I either: (1) want to create a new database rather than modifying an existing one; or (2) want to open an existing database where something is wrong if it does not exist.  For that reason, I have added these 2 options to the modified shell I use:
   -create          new DB file is to be created
   -nocreate        DB file is NOT to be created
In the startup options help, this is shown as
   -[no]create          DB file is to be created [or not]

With this change, it is an error for either: the named DB file to exist when -create is specified; or the named DB file to not exist when -nocreate is specified. With neither option specified, the auto-create or use-existing behavior remains.

Yes, in scripts using the shell tool, it is possible to handle file existence without these options. This change is but a minor convenience in such scripts.

For interactive use, it avoids the annoyance of accidentally creating DB files when that was not intended or messing with existing ones when intending to newly create a DB file.

If this is attractive to the sqlite3 shell tool authors or useful to others, I can prepare and submit patch.