tiNone Causes Error When Using Custome TILs

Forum related to Firebird

Moderators: gto, cipto_kh, EgonHugeist

doug4
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 02.04.2006, 05:43

tiNone Causes Error When Using Custome TILs

Postby doug4 » 04.03.2014, 23:08

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

marsupilami
Gold Boarder
Gold Boarder
Posts: 591
Joined: 17.01.2011, 14:17

Re: tiNone Causes Error When Using Custome TILs

Postby marsupilami » 05.03.2014, 09:56

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

miab3
Zeos Test Team
Zeos Test Team
Posts: 916
Joined: 11.05.2012, 12:32
Location: Poland

Re: tiNone Causes Error When Using Custome TILs

Postby miab3 » 05.03.2014, 18:01

@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

doug4
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: 02.04.2006, 05:43

Re: tiNone Causes Error When Using Custome TILs

Postby doug4 » 05.03.2014, 21:47

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

miab3
Zeos Test Team
Zeos Test Team
Posts: 916
Joined: 11.05.2012, 12:32
Location: Poland

Re: tiNone Causes Error When Using Custome TILs

Postby miab3 » 08.03.2014, 11:16

@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

papelhigienico
Expert Boarder
Expert Boarder
Posts: 113
Joined: 06.10.2006, 14:41
Location: Chapecó - Santa Catarina
Contact:

Re: tiNone Causes Error When Using Custome TILs

Postby papelhigienico » 24.06.2014, 14:25

The latest revision has the same behavior?

miab3
Zeos Test Team
Zeos Test Team
Posts: 916
Joined: 11.05.2012, 12:32
Location: Poland

Re: tiNone Causes Error When Using Custome TILs

Postby miab3 » 24.06.2014, 17:09

@papelhigienico,

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

Michal

User avatar
EgonHugeist
Zeos Dev Team
Zeos Dev Team
Posts: 1701
Joined: 31.03.2011, 22:38

Re: tiNone Causes Error When Using Custome TILs

Postby EgonHugeist » 30.11.2014, 02:16

@doug4

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

You want to help? viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image


Return to “Firebird”

Who is online

Users browsing this forum: No registered users and 1 guest