Page 1 of 2

How to start readonly transaction with TSQLConnection..

Posted: Mon 30 May 2011 09:17
by KB
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

Posted: Mon 30 May 2011 12:32
by AndreyZ
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;

Posted: Tue 31 May 2011 05:03
by KB
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?

Posted: Tue 31 May 2011 06:06
by AndreyZ
Yes, you should upgrade dbExpress driver for InterBase & Firebird. It supports read-only transactions starting with version 2.50.20.

Posted: Tue 31 May 2011 07:19
by KB
Thank you very much for your very prompt and complete answer :)

Posted: Tue 31 May 2011 07:34
by AndreyZ
If any other questions come up, please contact us.

Re: How to start readonly transaction with TSQLConnection..

Posted: Wed 27 Nov 2013 00:17
by respektive
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);

Re: How to start readonly transaction with TSQLConnection..

Posted: Wed 27 Nov 2013 12:30
by AndreyZ
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.

Re: How to start readonly transaction with TSQLConnection..

Posted: Wed 27 Nov 2013 13:03
by respektive
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

Re: How to start readonly transaction with TSQLConnection..

Posted: Wed 27 Nov 2013 13:08
by AndreyZ
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.

Re: How to start readonly transaction with TSQLConnection..

Posted: Wed 27 Nov 2013 13:57
by respektive
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

Re: How to start readonly transaction with TSQLConnection..

Posted: Wed 27 Nov 2013 14:23
by AndreyZ
We plan to release all dbExpress drivers as soon as Update 2 for RAD Studio XE5 is released.

Re: How to start readonly transaction with TSQLConnection..

Posted: Fri 20 Dec 2013 09:31
by respektive
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

Re: How to start readonly transaction with TSQLConnection..

Posted: Fri 20 Dec 2013 13:21
by AndreyZ
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 .

Re: How to start readonly transaction with TSQLConnection..

Posted: Fri 20 Dec 2013 13:37
by respektive
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.

:-)