I looked at the hdbc-sqlite code and found this comment :
The logic for handling change samples: look at the general changes before and after the request. If they are different, look at local changes. (It seems that the local change counter is not updated if the actual launch of the request that makes the changes is in accordance with the docs.)
This is normal because SQLite does not support using the given dbh in more than one thread.
The official Sqlite documentation has a whole page about this topic.
FAQ says:
(5) Can multiple applications or multiple instances of the same application access the same database file at the same time?
Several processes can simultaneously open the same database. Several processes can execute SELECT at the same time. But only one process can make changes to the database at any time at the same time, however.
This information excludes both of your approaches. Perhaps you can write some tests for this to show that this information is incorrect.
Svenk source share