Page 1 of 1

tiNone Causes Error When Using Custome TILs

Posted: 04.03.2014, 23:08
by doug4
I'm using ZeosLib 7.1.2-stable with Firebird version 2.5.2.26540. The following code causes error

"SQL Error: invalid format for transaction parameter block wrong version of transaction parameter block. Error Code: -901.

Code: Select all

    with ZConnection1 do
      begin
        Connected := false;

        Properties.Clear;
        ClientCodePage := 'UTF8';
        Database := 'test_db';
        HostName := 'myhost';
        LibraryLocation := 'fbclient.dll';
        Password := 'abc';   
        Protocol := 'firebird-2.5';
        ReadOnly := false;
        TransactIsolationLevel := tiNone;
        UseMetadata := false;
        User     := 'user1';

        Properties.Add('Dialect=3');
        Properties.Add('rolename=admin');
        Properties.Add('controls_cp=CP_UTF8');

        Properties.Add('isc_tpb_read_committed');
        Properties.Add('isc_tpb_write');  
        Properties.Add('isc_tpb_rec_version');
        Properties.Add('isc_tpb_nowait');

        Connected := true;    // this statement causes the parameter block error
      end;   // with ZConnection1 do
If tiReadCommitted, tiRepeatableRead, or tiSerializalble are used in place of tiNone for the transaction isolation level, then I do not get
an error when the "Connected := true;" statement is executed, however it seems that the custom TIL properties are ignored.

Is there something wrong with the code or is there a bug with tiNone and custom TIL parameters?
How do you use custom Firebird transaction parameters with ZeosLib?

Thanks,
doug4

Re: tiNone Causes Error When Using Custome TILs

Posted: 05.03.2014, 09:56
by marsupilami
Hello doug4,

I did some digging around and it seems that currently there is a bug that keeps you from doing these things right. The parameters you want to use are exactly what Zeos uses for tiReadCommitted. So I suggest you don't add these paramters yourself for now and just use tiReadCommitted.
Best regards,

Jan

Re: tiNone Causes Error When Using Custome TILs

Posted: 05.03.2014, 18:01
by miab3
@doug4, @marsupilami,

I can not find source of error (additional parameters are duplicated).

Ad hoc do so.
In ZDbcInterbase6.pas after lines:

Code: Select all

   begin
      { Add user defined parameters for transaction }
      Params.Clear;
      Params.AddStrings(Info);
add:

Code: Select all

     // M.A removing duplicates
      for i := Params.Count-1 downto 1 do
       for j := 0 to i-1 do
       if Params[i] = Params[j] then
         Params.Delete(i);
and of course i, j: integer; in var procedure TZInterbase6Connection.StartTransaction;

Michal

Re: tiNone Causes Error When Using Custome TILs

Posted: 05.03.2014, 21:47
by doug4
marsupilami wrote:Hello doug4,

I did some digging around and it seems that currently there is a bug that keeps you from doing these things right. The parameters you want to use are exactly what Zeos uses for tiReadCommitted. So I suggest you don't add these paramters yourself for now and just use tiReadCommitted.
Best regards,

Jan
Thanks for the confirmation that there is a bug. The example I gave may match tiReadCommitted, however it was just an example. I am hoping to get total control of transactions, especially I want a lock conflict to be returned either immediately or within a few seconds for all transaction isoloation levels by using either "isc_tpb_nowait" or "isc_tpb_wait and isc_tpb_lock_timeout=2". It seems that tiSerializable does not include "isc_tpb_nowait" because a lock conflict is not immediately returned as it is with tiReadCommitted and tiRepeatableRead.

Putting differenct types of locks on a specific table would be another example where customized control is needed.
Again, thanks for the feedback.

- doug4

Re: tiNone Causes Error When Using Custome TILs

Posted: 08.03.2014, 11:16
by miab3
@doug4

In addition to my fix deletes the duplicates, isc_tpb_version3 should be added as the first:

Code: Select all

        ..        
        Properties.Add('isc_tpb_version3');  // <----
        Properties.Add('isc_tpb_read_committed');
        Properties.Add('isc_tpb_write');  
        Properties.Add('isc_tpb_rec_version');
        Properties.Add('isc_tpb_nowait');
       ..
Michal

Re: tiNone Causes Error When Using Custome TILs

Posted: 24.06.2014, 14:25
by papelhigienico
The latest revision has the same behavior?

Re: tiNone Causes Error When Using Custome TILs

Posted: 24.06.2014, 17:09
by miab3
@papelhigienico,

Yes, the error duplicating additional parameters still exists.
(In Zeos7.2-alpha branches_ testing_r3174)

Michal

Re: tiNone Causes Error When Using Custome TILs

Posted: 30.11.2014, 02:16
by EgonHugeist
@doug4

sorry for my absence. It should work now. Patch done R3524/3526 /testing-7.2 (SVN)