SQLITE: Database is locked

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
shulkevich
Posts: 5
Joined: Thu 13 Mar 2014 09:49

SQLITE: Database is locked

Post by shulkevich » Sat 14 Mar 2015 17:26

I'm using Unidac 5.3 with SQLite provider.
I have to access database file from some different applications simultaniosly.
I created simple delphi application that creates 1 TUniConnection plus 1 TUniTable.
When it started i run application #2 which access the same database file for update.
So application #2 gets "Database is locked" when tries to commit its updates.

How can i open TUniTable and not lock database file?

My experimets show that problem raise only when i access table with recordcount exceeded TUniTable.FetchRows. When opened table has recordcount less then FetchRows than database file is not locked.

I tried TUniConnection.DisconnectedMode := True with TUniTable.FetchAll := True but it did not help.

shulkevich
Posts: 5
Joined: Thu 13 Mar 2014 09:49

Re: SQLITE: Database is locked

Post by shulkevich » Sun 15 Mar 2015 13:28

So. I do not understand - for what reason TUniTable has FetchAll property. It does not work. But TUniTable.SpecificOptions.Values['FetchAll'] does.
And BTW - why SQLite provider does not have 'FetchAll' specificoption? and why does Postgres provider have such an option?
My problem has been resolved by specifying TUniTable.SpecificOptions.Values['FetchAll'] = 'True'.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: SQLITE: Database is locked

Post by AlexP » Mon 16 Mar 2015 08:36

Hello,

TUniTable has no FetchAll property. To set the FetchAll value, you should use SpecificOptions for all the providers.

shulkevich
Posts: 5
Joined: Thu 13 Mar 2014 09:49

Re: SQLITE: Database is locked

Post by shulkevich » Mon 16 Mar 2015 13:14

AlexP wrote:Hello,

TUniTable has no FetchAll property. To set the FetchAll value, you should use SpecificOptions for all the providers.
It does have.

TUntTable -> TCustomUniDataset -> TCustomDADataset

Code: Select all

TCustomDADataSet = class (TMemDataSet)
  private
  protected
    FFetchAll: boolean;
    function GetFetchAll: boolean; virtual;
    procedure SetFetchAll(Value: boolean); virtual;
    property FetchAll: boolean read GetFetchAll write SetFetchAll default False;
  public
  end;
and if i read this one http://www.devart.com/unidac/docs/index ... rticle.htm then i think that there is no FetchAll option in TUniConnection for SQLite, only in TuniTable.
and if suddenly it is then it does not work.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: SQLITE: Database is locked

Post by AlexP » Mon 16 Mar 2015 13:37

SpecificOption FetchAll is described in the TUniQuery, TUniTable, TUniStoredProc sections.

Post Reply