Page 1 of 1

Start read only transactions not work

Posted: Thu 13 Jan 2022 12:48
by delphiman
Hello, I'm performing some tests where I need to perform a query in the database in read-only mode, that is, I want to start a read-only transaction, consult the data and close this transaction.

I did several tests configuring transaction isolation, but I may be doing something wrong as it is not querying with the isolation I request.

Can you give me a correct example of how to use it?

Sample:

Code: Select all

IBCConnection1.DefaultTransaction.IsolationLevel := iblReadOnlyReadCommitted;
IBCConnection1.Open;
IBCConnection1.StartTransaction;
IBCQuery1.Close;
IBCQuery1.SQL.Text := 'select * from test';
IBCQuery1.Open;
IBCConnection1.Commit;

Thanks.

Best Regarts;

Re: Start read only transactions not work

Posted: Fri 14 Jan 2022 15:49
by pavelpd
Hi there!

Thank you for your question!

We checked the work of the code fragment you have sent and found no issues.
Your code does not contain any data modification operations, so it runs without any errors or warnings. In case of execution of any request to change the data, you will receive a message "attempted update during read-only transaction".
Please, explain what is incorrect in such behavior from your point of view?