How to start readonly transaction with TSQLConnection..

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for InterBase & Firebird in Delphi and C++Builder
KB
Posts: 3
Joined: Mon 30 May 2011 09:08

How to start readonly transaction with TSQLConnection..

Post by KB » Mon 30 May 2011 09:17

Hi

i have devart dbExpress driver for Firebird with source code but without access components.

How can i start read only transaction with TSQLConnection or TCRSQLconnection?

KB

AndreyZ

Post by AndreyZ » Mon 30 May 2011 12:32

Hello,

To start a read-only transaction, you should use the following code:

Code: Select all

procedure TMainForm.BitBtnClick(Sender: TObject);
var
  tr: TTransactionDesc;
begin
  SQLConnection.Open;
  tr.IsolationLevel := xilCUSTOM;
  tr.CustomIsolation := 1; // flag that transaction is read-only
  SQLConnection.StartTransaction(tr);
end;

KB
Posts: 3
Joined: Mon 30 May 2011 09:08

Post by KB » Tue 31 May 2011 05:03

I test this and this not work - transaction is not read only.
Is this available in dbxida 2.40.0.12 or i must have some recent version?

AndreyZ

Post by AndreyZ » Tue 31 May 2011 06:06

Yes, you should upgrade dbExpress driver for InterBase & Firebird. It supports read-only transactions starting with version 2.50.20.

KB
Posts: 3
Joined: Mon 30 May 2011 09:08

Post by KB » Tue 31 May 2011 07:19

Thank you very much for your very prompt and complete answer :)

AndreyZ

Post by AndreyZ » Tue 31 May 2011 07:34

If any other questions come up, please contact us.

respektive
Posts: 9
Joined: Wed 27 Nov 2013 00:09

Re: How to start readonly transaction with TSQLConnection..

Post by respektive » Wed 27 Nov 2013 00:17

Hello,

I'm trying trial version of your components, because I need read-only trans.
I use C++Builder XE.
I installed driver from package, and then I changed library in TSQLConnection to dbexpida40.dll, and set up trans. desc. as you write. But newly opened trans. is not read-only.
What I should do, to do it correctly?

Code: Select all

TTransactionDesc td;
	td.TransactionID = 1;
	td.IsolationLevel = xilCUSTOM;
	td.CustomIsolation = 1; //ciREADONLY;
	SQLConnection1->StartTransaction(td);

AndreyZ

Re: How to start readonly transaction with TSQLConnection..

Post by AndreyZ » Wed 27 Nov 2013 12:30

Thank you for the information. We have reproduced this problem. It occurs because the TSQLConnection.StartTransaction method ignores the xilCUSTOM isolation level. Here it is:

Code: Select all

procedure TSQLConnection.StartTransaction( TransDesc: TTransactionDesc);
var
  Isolation: TDBXIsolation;
begin
  case TransDesc.IsolationLevel of
    xilREADCOMMITTED:
      Isolation := TDBXIsolations.ReadCommitted;
    xilREPEATABLEREAD:
      Isolation := TDBXIsolations.RepeatableRead;
    xilDIRTYREAD:
      Isolation := TDBXIsolations.DirtyRead;
//    xilCUSTOM:
    else
      Isolation := TDBXIsolations.ReadCommitted;
  end;
  BeginTransaction(TransDesc, Isolation);
end;
As you can see, the xilCUSTOM isolation level is ignored, instead the ReadCommitted isolation level is used.
To avoid this problem, we added a workaround in our driver. Now, to use the custom read-only transaction, you should use the following code:

Code: Select all

SQLConnection1->Open();
TDBXTransaction* tr;
tr = SQLConnection1->BeginTransaction(5); // TDBXIsolations.SnapShot + 1
This workaround will be available in the next dbExpress driver for InterBase and Firebird build.

respektive
Posts: 9
Joined: Wed 27 Nov 2013 00:09

Re: How to start readonly transaction with TSQLConnection..

Post by respektive » Wed 27 Nov 2013 13:03

Thank you for quick answer, but I should set up something more - because it failed

Image

Image

I hope the images will work.

Thanks a lot, Tom

AndreyZ

Re: How to start readonly transaction with TSQLConnection..

Post by AndreyZ » Wed 27 Nov 2013 13:08

As I wrote you above, this workaround will be available in the next dbExpress driver for InterBase and Firebird build. You cannot use it with the current version of dbExpress driver for InterBase and Firebird.

respektive
Posts: 9
Joined: Wed 27 Nov 2013 00:09

Re: How to start readonly transaction with TSQLConnection..

Post by respektive » Wed 27 Nov 2013 13:57

Sorry,

I understand it that the CustomIsolation will work in next version, and BeginTransaction(5) works now.

Ok, I will wait - do you know some time aproximation of new release?

Best regards
Tom

AndreyZ

Re: How to start readonly transaction with TSQLConnection..

Post by AndreyZ » Wed 27 Nov 2013 14:23

We plan to release all dbExpress drivers as soon as Update 2 for RAD Studio XE5 is released.

respektive
Posts: 9
Joined: Wed 27 Nov 2013 00:09

Re: How to start readonly transaction with TSQLConnection..

Post by respektive » Fri 20 Dec 2013 09:31

Hi, RAD Studio Update 2 is on the net, how about your components :-)

This feature is very important for us, so we need to test it before we buy it.
And the time flow so fast...

Thanky you in advance
Tom

AndreyZ

Re: How to start readonly transaction with TSQLConnection..

Post by AndreyZ » Fri 20 Dec 2013 13:21

We plan to release all DAC products with RAD Studio XE5 Update 2 support next week. After this, we will release all dbExpress drivers.
But if you need this fix as soon as possible, we can send you a custom build with this fix. Please send your dbExpress driver for InterBase and Firebird license number to andreyz*devart*com .

respektive
Posts: 9
Joined: Wed 27 Nov 2013 00:09

Re: How to start readonly transaction with TSQLConnection..

Post by respektive » Fri 20 Dec 2013 13:37

I need demo version - because we did not buy it yet - we need this functionality - so we are searching for dbexpress component that allows it.

:-)

Post Reply