Devart Drive for DBEXPRESS/Firebird only supports transactions like ReadCommitted ?

Devart Drive for DBEXPRESS/Firebird only supports transactions like ReadCommitted ?

Postby LuizMoura » Mon 15 Oct 2012 04:08

In the book I have on Firebird shows when using a transaction type Concurrency, and that Firebird supports this type.
But all the examples I see are always ReadCommitted.
I've tried to configure Concurrency, but does not have this type in the options that appear.
Is that right?
Do not have this option?
And how I do to set "wait" (that wait for the solution of a conflict)
Can anyone help-me with the code ?
Thanks
Devart 270
Delphi 2010
Firebird 2.51
LuizMoura
 
Posts: 7
Joined: Sun 21 Aug 2011 02:47

Re: Devart Drive for DBEXPRESS/Firebird only supports transactions like ReadCommitted ?

Postby AndreyZ » Mon 15 Oct 2012 09:39

Hello,

To start Concurrency transactions, you can use the following code:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
  tr: TTransactionDesc;
begin
  tr.IsolationLevel := xilREPEATABLEREAD;
  SQLConnection1.Open;
  SQLConnection1.StartTransaction(tr);
end;
To set the wait parameter of a transaction, you should use the WaitOnLocks connection option. Here is a code example:
Code: Select all
SQLConnection1.Params.Values['WaitOnLocks'] := 'True';
You can find more information in the dbExpress driver for InterBase & Firebird documentation (the Readme.html file).
AndreyZ
 

Re: Devart Drive for DBEXPRESS/Firebird only supports transactions like ReadCommitted ?

Postby LuizMoura » Sun 21 Oct 2012 02:14

Very grateful for the response.
I had found this type, but could not confirm the information, that xilREPEATABLEREAD is the Concurrency, until you wrote.

But now I have more one question, please read the code below.
tr.IsolationLevel := xilREPEATABLEREAD;
SQLConnection1.Open;
SQLConnection1.StartTransaction(tr);
In your examples, you never numbering transaction !
I do so:

inc(igTrans);
tr.TransactionId:= igTrans ;
Tr.Isolationlevel......
So,does it make any difference?
Or no need to identify the number of the transaction to avoid conflict, or same by any other reason.
I can to stop to do so ?
Thanks
LuizMoura
 
Posts: 7
Joined: Sun 21 Aug 2011 02:47

Re: Devart Drive for DBEXPRESS/Firebird only supports transactions like ReadCommitted ?

Postby AndreyZ » Mon 22 Oct 2012 09:33

If you specify the TransactionID property, it means that you want to start another transaction. Here is a code example that demonstrate this:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
var
  tr: TTransactionDesc;
begin
  FillChar(tr, sizeof(TTransactionDesc), 0);
  tr.TransactionID := 1;
  tr.IsolationLevel := xilREADCOMMITTED;
  SQLConnection1.Open;
  SQLConnection1.StartTransaction(tr); // here a new transaction with TransactionID=1 is started
  SQLConnection1.StartTransaction(tr); // here nothing happens, because it is the same transaction
  tr.TransactionID := 2;
  SQLConnection1.StartTransaction(tr); // here a new transaction with TransactionID=2 is started
end;
So, if you want to use multiple transactions, you should specify the TransactionID property for each of them.
AndreyZ
 


Return to dbExpress driver for InterBase & Firebird