Page 1 of 1

isolation level on the transaction

Posted: Mon 21 Jan 2013 21:22
by nejamube
Hi.

How I can change the isolation level on the transaction?

http://www.postgresql.org/docs/9.1/stat ... n-iso.html


Thanks.

Re: isolation level on the transaction

Posted: Tue 22 Jan 2013 11:47
by AlexP
Hello,

For the time being, you can control the transaction behavior using the TPgTransaction class in the following way:

Code: Select all

uses ..., CRAccess;

var
  PgConnection: TPgConnection;
  PgTransaction: TPgTransaction;
begin
  PgConnection := TPgConnection.Create(nil);
  PgTransaction :=  TPgTransaction.Create(nil);
  PgTransaction.DefaultConnection := PgConnection;
  PgTransaction.IsolationLevel := ilRepeatableRead;
  PgTransaction.StartTransaction;
IsolationLevel is described in the CRAccess module and can take the following values:
ilReadCommitted, ilSnapshot, ilRepeatableRead, ilReadUncommitted

Re: isolation level on the transaction

Posted: Tue 22 Jan 2013 17:15
by nejamube
Hi, thanks for your answer.

What I have to select for isolation serializable (ilSnapshot, ilRepeatableRead, ??)?

http://www.postgresql.org/docs/9.1/stat ... n-iso.html

Best Regards

Re: isolation level on the transaction

Posted: Wed 23 Jan 2013 09:22
by AlexP
Hello,

To use Serializable Isolation Level, you should set the PgTransaction.IsolationLevel property to ilSnapshot.

Code: Select all

ilReadCommitted = READ COMMITTED
ilSnapshot = SERIALIZABLE
ilRepeatableRead = REPEATABLE READ
ilReadUncommitted = READ UNCOMMITTED