As far as I know, there are no special sqlite commands to control locking. However, you can force sqlite to lock the database using create transaction . For instance:
BEGIN IMMEDIATE TRANSACTION; ... COMMIT TRANSACTION; BEGIN EXCLUSIVE TRANSACTION; ... COMMIT TRANSACTION;
If you read a document related to a document, you should better understand the difference between IMMEDIATE
and EXCLUSIVE
transactions.
It might be worth noting that sqlite locks apply to the entire database, and not just to individual tables, unlike the LOCK TABLE
statement in other SQL databases.
source share