Page 1 of 1

SQLITE: Database is locked

Posted: Sat 14 Mar 2015 17:26
by shulkevich
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.

Re: SQLITE: Database is locked

Posted: Sun 15 Mar 2015 13:28
by shulkevich
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'.

Re: SQLITE: Database is locked

Posted: Mon 16 Mar 2015 08:36
by AlexP
Hello,

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

Re: SQLITE: Database is locked

Posted: Mon 16 Mar 2015 13:14
by shulkevich
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.

Re: SQLITE: Database is locked

Posted: Mon 16 Mar 2015 13:37
by AlexP
SpecificOption FetchAll is described in the TUniQuery, TUniTable, TUniStoredProc sections.