Hello,
I use attached databases with SQLite on my projects and it works well with Zeosdb 7.0 and 7.1.
But it no longer works with Zeosdb 7.2 and 8.0.
My need is to open a "master" database and attach another detail database among several available. We open only one detail database at a time. It is closed to open another but without closing the "master" database or the datasets linked to it.
To close the detail database, we close all the datasets linked to this database and then use the DETACH DATABASE "detail" instruction.
The DETACH DATABASE instruction causes a locked database error if we have opened more than one table in the "master" database.
Attached is a test program source (include 2 files db3): Use the Open, Attach and Detach buttons in order to get the error.
Note: Compiler is Delphi 10.3
Thank you for your help.
SQLite detach database produces database is locked error
SQLite detach database produces database is locked error
You do not have the required permissions to view the files attached to this post.
Re: SQLite detach database produces database is locked error
Hello,
After several days of research, we found a workaround.
I don't know if it is sustainable but it currently works with ZeosDb V8.0.
Description:
The problem comes from the fact that some Datasets opened on database 1 also cause database 2 to be locked even though all Datasets in database 2 are closed.
The locking is due to the fact that the Dataset cursor remains active until all records are browsed.
The workaround consists of executing the FetchAll method on all Datasets still open in order to close the cursors.
See the source code of the attached example.
After several days of research, we found a workaround.
I don't know if it is sustainable but it currently works with ZeosDb V8.0.
Description:
The problem comes from the fact that some Datasets opened on database 1 also cause database 2 to be locked even though all Datasets in database 2 are closed.
The locking is due to the fact that the Dataset cursor remains active until all records are browsed.
The workaround consists of executing the FetchAll method on all Datasets still open in order to close the cursors.
See the source code of the attached example.
You do not have the required permissions to view the files attached to this post.