delphifirebirdfibplus

Read uncommitted using Firebird FIBPlus components


Using a TpFIBTransaction component, I'm trying to start a READ UNCOMMITTED transaction.

First of all, the TPBMode property has 3 possible values:

In TpFIBTransaction.StartTransaction I saw that setting tpbReadCommitted forces the following parameters:

Using tpbRepeatableRead forces the following parameters instead:

So, it seems the only way to have "custom" transaction parameters is to set the tpbDefault value.

The values allowed for the TrParams property are the following (from fib.pas unit)

  TPBConstantNames: array[1..isc_tpb_last_tpb_constant] of String = (
    'consistency',
    'concurrency',
    'shared',
    'protected',
    'exclusive',
    'wait',
    'nowait',
    'read',
    'write',
    'lock_read',
    'lock_write',
    'verb_time',
    'commit_time',
    'ignore_limbo',
    'read_committed',
    'autocommit',
    'rec_version',
    'no_rec_version',
    'restart_requests',
    'no_auto_undo',
    'no_savepoint'
  );

I've tried adding the 'read' value only, but it seems it's still unable to read uncommitted data, even if there's not 'read_committed' in TrParams property.

MyTransaction.TrParams.Clear();
MyTransaction.TrParams.Add('read');

Is there some missing value in TPBConstantNames (Something like 'read_uncommitted', if it exists...), or is there another way to setup a Firebird "read uncommitted" transaction?


Solution

  • It is not possible because Firebird does not support read uncomitted isolation level.

    You can find the following information in the documentation documentation:

    Note
    The READ UNCOMMITTED isolation level is a synonym for READ COMMITTED, and provided only for syntax compatibility. It provides the exact same semantics as READ COMMITTED, and does not allow you to view uncommitted changes of other transactions.

    and:

    The three isolation levels supported in Firebird are:

    SNAPSHOT

    SNAPSHOT TABLE STABILITY

    READ COMMITTED with two specifications (NO RECORD_VERSION and RECORD_VERSION)