Page 1 of 1

Interbase: OldTransactionBehaviour fails!

Posted: Tue 24 Jan 2017 19:48
by invent
Hello,

are you sure, that

Code: Select all

OldTransactionBehaviour := true;

works?

I have a TUniConnection and a TUniQuery and made some inserts:

Code: Select all

  UniConnection1.StartTransaction;
  okay := true;

   for i := 0 to MyStringList.Count - 1 do
    begin

    Bef := 'insert into AUFTRAGSSTUECKLISTE values (...)';
    UniQuery1.SQL.Clear;
    UniQuery1.SQL.Add (Bef);

    try
      UniQuery1.Execute;
    except
      okay := false;
      break;
    end; { try .. except }
    end; { for i }

  if Okay
    then UniConnection1.Commit
    else UniConnection1.Rollback;
Here is the last part of DBMonitor's logfile:
24.01.2017 20:12:56 0,000 SQL Execute: insert into AUFTRAGSSTUECKLISTE values ('AU','236561','1','10552','0','1',Null,'1','J','15307','0','Vierkant 40 AlCuMgPb, gezogen',Null,'0.024',Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null)
Complete
24.01.2017 20:12:56 0,000 CommitRetaining: Complete
24.01.2017 20:12:56 0,000 SQL Execute: insert into AUFTRAGSSTUECKLISTE values ('AU','236561','1','16673','0','2',Null,'2','J','16669','0','Tasterkolben Ø8x32',Null,'1.000',Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null)
Complete
24.01.2017 20:12:56 0,000 CommitRetaining: Complete
24.01.2017 20:12:56 0,000 SQL Execute: insert into AUFTRAGSSTUECKLISTE values ('AU','236561','1','16669','0','1',Null,'1','J','15085','0','Rund 008 AlCuMgPb gepreßt F38',Null,'0.036',Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null,Null)
Error: violation of PRIMARY or UNIQUE KEY constraint "IXAUFTRAGSSTCKLPOS1MULTIKEY1" on table "AUFTRAGSSTUECKLISTE"
24.01.2017 20:12:56 0,000 CommitRetaining: Complete
24.01.2017 20:12:56 0,000 Rollback: Complete
The problem is that after the rollback all inserted records are in the database!!!

I'm sure, rollback works in UniDAC 4.5.9.

Please take a look at this problem. It cost me all day...

Kind regards,
Gerd Brinkmann
invent GmbH

Re: Interbase: OldTransactionBehaviour fails!

Posted: Wed 25 Jan 2017 10:43
by ViktorV
This behavior is not related to the global variable OldTransactionBehaviour value. It is related to the AutoCommit value.
The AutoCommit property has the True value by default that leads to automatically execution of CommitRetaining or RollbackRetaining when there is any data modification. By setting the property to False, you will get rid of this behavior, however, you will have to manage the transactions by yourself.
The TUniConnection.AutoCommit property has a higher priority than the specific option "AutoCommit" of datasets (TUniQuery, TUniTable). If the TUniConnection.AutoCommit property is set to False, all transactions can be committed only explicitly (despite of the specific option "AutoCommit" value of a dataset).
So, to solve the issue, please set the AutoCommit property to False for TUniConnection or dataset.

Re: Interbase: OldTransactionBehaviour fails!

Posted: Wed 25 Jan 2017 11:19
by invent
Hello,

why is there no documentation about this? In your text http://www.devart.com/unidac/docs/?work_transaction.htm your wrote
After you have activated a transaction, all operations, including dataset opening, will be performed within the context of the current transaction until you commit or rollback it. If no transactions were started, changes performed by each operation are reflected in database right after the operation is completed (so-called AutoCommit mode).
That is exactely the opposite of your reply.

Meanwhile, I am very upset about the update policy of Devart. When you make new properties to a component the old behaviour must be the default. Or you have to describe that. But in https://www.devart.com/unidac/docs/?com ... ld_ver.htm is nothing about the new transaction behaviour.

An update is for me to deinstall the old version, install the new version, compile all procjects and the program works as before. Alle new properties and methods are optional and not the default settings.

Since 8 days I try to use the new UniDac version. I have no more nerves to look for any change from UniDac 4.5 to 6.4. Where can I find a complete list of compatibility issues?

Kind regards,
Gerd Brinkmann
invent GmbH

Re: Interbase: OldTransactionBehaviour fails!

Posted: Thu 26 Jan 2017 14:56
by ViktorV
Thank you for the information. We will add this information in UniDAC help.