isolation level on the transaction

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
nejamube
Posts: 4
Joined: Sat 26 Nov 2011 00:45

isolation level on the transaction

Post by nejamube » Mon 21 Jan 2013 21:22

Hi.

How I can change the isolation level on the transaction?

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


Thanks.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: isolation level on the transaction

Post by AlexP » Tue 22 Jan 2013 11:47

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

nejamube
Posts: 4
Joined: Sat 26 Nov 2011 00:45

Re: isolation level on the transaction

Post by nejamube » Tue 22 Jan 2013 17:15

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

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: isolation level on the transaction

Post by AlexP » Wed 23 Jan 2013 09:22

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

Post Reply