Start a transaction with BEGIN IMMEDIATE
Execute the selects necessary to compute "major"
Execute the "insert"
COMMIT the transaction
Write operations are always exclusive. You merely need to start the "I need to
write something" transaction before you read the database so that no one else
can get in and make changes while you are working.
Or do you mean that the "network" is broken and that locking does not work
properly, which is a common occurrence with most network file systems? It is
also why using SQLite (or any multiuser accessed/updated file) over a Network
Filesystem is ill-advised.
Also, are you using the term "tables" loosely to mean two databases? Or are
you actually referring to two tables in the same database?
The fact that there's a Highway to Hell but only a Stairway to Heaven says a
lot about anticipated traffic volume.
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of MONSTRUO Hugo González
>Sent: Friday, 29 September, 2017 20:19
>Subject: [sqlite] lock base
>I have a network of computers that share a SQLite file.
>Two tables share sales information: current and historical.
>When I record a new record I must put a code equal to the major + 1.
>I need to put the database in exclusivity to avoid recording records
>the same code.
>How I do this ?
>sqlite-users mailing list
sqlite-users mailing list