Opens a store's writer connection in the order of ruling P1. (1) When
the file exists, its version is read on a read-only connection, and a
newer or negative store is refused before anything else. (2) A
read-write connection is opened, creating a missing file, with
busy_timeout, kept WAL files and WAL mode. (3) One BEGIN IMMEDIATE
transaction reads the version again, refuses on that read, creates the
tables and stamps a store that read 0. A newer store fails with
StoreVersionNewer; every other failure is the store's own error, and
a lock held past busy_timeout at step 3 fails as the store's
failure maps SQLITE_BUSY. The connection is closed on any failure; on
success the caller owns it.
Opens a store's writer connection in the order of ruling P1. (1) When the file exists, its version is read on a read-only connection, and a newer or negative store is refused before anything else. (2) A read-write connection is opened, creating a missing file, with
busy_timeout, kept WAL files and WAL mode. (3) OneBEGIN IMMEDIATEtransaction reads the version again, refuses on that read, creates the tables and stamps a store that read 0. A newer store fails withStoreVersionNewer; every other failure is the store's own error, and a lock held pastbusy_timeoutat step 3 fails as the store'sfailuremaps SQLITE_BUSY. The connection is closed on any failure; on success the caller owns it.