Page 1 of 1

Exception using TryKeepDataOnDisconnect property

Posted: 09.03.2021, 21:38
by brunodelmondes
Hi there!

I'm using Zeos SVN 7378 on Delphi 2010 + Firebird 2.1 testing new behavior of TryKeepDataOnDisconnect property on datasets.
Considering the sequence of the code below, it causes the EZIBSQLException = -904 Message: isc_dsql_allocate_statement.

#1 - Connect the database and open the query with some properties

Code: Select all

procedure TForm1.btnOpenClick(Sender: TObject);
begin
  if not ZConnection1.Connected then
    ZConnection1.Connect;

  if ZQuery1.Active then
    ZQuery1.Close;

  ZQuery1.CachedUpdates := true;
  ZQuery1.TryKeepDataOnDisconnect := true;

  ZQuery1.Open;
end;
#2 - Disconnect from the database

Code: Select all

procedure TForm1.btnConnDisconnClick(Sender: TObject);
begin
    if not ZConnection1.Connected then
      ZConnection1.Connect
    else
      ZConnection1.Disconnect;
end;
#3 - Did some changes and post them, then I execute the below code

Code: Select all

procedure TForm1.btnApplyUpdatesClick(Sender: TObject);
begin
  if ZQuery1.UpdatesPending then
  begin
    if not ZConnection1.Connected then
      ZConnection1.Connect;
    ZQuery1.ApplyUpdates;
    ZQuery1.CommitUpdates;
    ZQuery1.Refresh;
  end;
end;
I realize that the exception occurs when ZQuery1.Refresh executes. The same happens if I execute ZQuery1.Close followed by ZQuery1.Open;

Re: Exception using TryKeepDataOnDisconnect property

Posted: 09.03.2021, 22:08
by marsupilami
Hello Bruno,

could you please open a bug report on SourceForge for this?

Best regards,

Jan

Re: Exception using TryKeepDataOnDisconnect property

Posted: 10.03.2021, 12:09
by brunodelmondes
Yeah, no problem.

Thanks Jan!

Re: Exception using TryKeepDataOnDisconnect property

Posted: 11.03.2021, 06:55
by EgonHugeist
Hi Bruno,
your are faster on testing than me on announcing the features.

Bruno i'll check your examples. The FB exception should not be thrown. Thus i accapt the ticket. What i miss in your code is:

Code: Select all

Query/Table.FetchAll
That's why the property starts with "Try". I still think it's not a good idea for automatic load all data even if the property is enabled.

So can you test my remarks and report your findings?

Re: Exception using TryKeepDataOnDisconnect property

Posted: 12.03.2021, 14:07
by brunodelmondes
Hi Michael,
your are faster on testing than me on announcing the features.
LOL
That's because I like Zeoslib so much and that feature will be very very much helpful for me.
Bruno i'll check your examples. The FB exception should not be thrown. Thus i accapt the ticket. What i miss in your code is:

Code: Select all

Query/Table.FetchAll
That's why the property starts with "Try". I still think it's not a good idea for automatic load all data even if the property is enabled.
So, I tested with FetchAll after opening ZQuery and after ApplyUpdates... still same error. I forgot to mention that property FetchRow was Zero (default) when I first ran into the error.