Page 1 of 1

AV on second try of ZQuery.Post

Posted: 30.06.2021, 21:52
by brunodelmondes
Hey guys!

I was doing some tests with Zeos 8 SVN 7589 on Delphi 2010 and Firebird 4.0.0.2496 (relase). On firebird.conf I setted DataTypeCompatibility = 3.0 property. Here is the DML of the table on FB database:

Code: Select all

CREATE TABLE PRODUCT
(
  ID INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 1) NOT NULL,
  DESCRIPTION VARCHAR(60),
  PRICE NUMERIC(15,4) DEFAULT 0,
  CONSTRAINT INTEG_3 PRIMARY KEY (ID)
);
I have an ZConnection (Conn) and ZQuery (qryProd) with default configurations.
Conn = TransactionLevel: tiReadCommited, Charset WIN1252

The below code is causing an access violation at line 1497 of ZDbcCache unit, it just happens on the second try:
( stCurrency: Statement.SetCurrency(StatementIndex, PCurrency(Data)^); )

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin

  if not Conn.Connected then
  begin
    Conn.Disconnect;
    Conn.Connect;
  end;

  if not qryProd.Active then
  begin
    qryProd.Close;
    qryProd.Open;
  end;

  with qryProd do
  begin
    Append;
    FieldByName('description').AsString := 'test ' + IntToStr(Random(100000));
    FieldByName('price').AsCurrency := Random(1000);
    Post;
  end;

end;

Re: AV on second try of ZQuery.Post

Posted: 01.07.2021, 09:38
by marsupilami
Hello Bruno,

I assume you use "firebird" as the protocol? Could you please test what happens if you use the "interbase" protocol? Background: firebird uses the "new" interface based API as a default whereas the interbase protocol uses the legacy API.

Best regards,

Jan

Re: AV on second try of ZQuery.Post

Posted: 01.07.2021, 18:28
by brunodelmondes
Hello Jan,
I assume you use "firebird" as the protocol?
Yes, forgot to mension that.
Could you please test what happens if you use the "interbase" protocol?
Just tested, same AV hapens at the same line and unit I mensioned above.

Re: AV on second try of ZQuery.Post

Posted: 02.07.2021, 10:46
by marsupilami
Hello Bruno,

I created a ticket on our bug tracker for this. It will take some days for me to add a test case and see what I can do.

Best regards,

Jan

Re: AV on second try of ZQuery.Post

Posted: 02.07.2021, 11:50
by miab3
Simply put, the problem occurs when you try to enter a second record into the table above.
I also have it, for FB3.
Additionally, I was able to trigger such an error messages:
PROD_ERR.png
Michał

Re: AV on second try of ZQuery.Post

Posted: 02.07.2021, 13:05
by brunodelmondes
Hello Jan,
I created a ticket on our bug tracker for this. It will take some days for me to add a test case and see what I can do.
All right, thank you!

Hello Michal,
I managed to get something like this:
Well, I get a common AV error message and, as I said, I'm testing Firebird 4 stable, I don't know if that's why.

Re: AV on second try of ZQuery.Post

Posted: 07.07.2021, 08:56
by marsupilami
Hello Bruno hello Michal,

I added a fix for this in r7600 and r7601. Could you please check if this fixes your problems?

Best regards,

Jan

Re: AV on second try of ZQuery.Post

Posted: 07.07.2021, 13:22
by brunodelmondes
Thank you Jan, it's working fine now.

Re: AV on second try of ZQuery.Post

Posted: 07.07.2021, 13:24
by miab3
Hi Jan,

It looks like you have successfully fixed the bug.
Now it works for me without errors with Firebird 3.
Delphi 10.3.3 Win32/64 Zeos8 trunk r7600.

Michał