Access Mode
From InterBase
Go Up to Specifying SET TRANSACTION Behavior
The access mode parameter specifies the type of access a transaction has for the tables it uses. There are two possible settings:
READ ONLY
specifies that a transaction can select data from a table, but cannot insert, update, or delete table data.READ WRITE
specifies that a transaction can select, insert, update, and delete table data. This is the default setting if none is specified.
InterBase assumes that most transactions both read and write data. When starting a transaction for reading and writing, READ WRITE
can be omitted from SET TRANSACTION
statement. For example, the following statements start a transaction, t1
, for READ WRITE
access:
EXEC SQL SET TRANSACTION NAME t1; EXEC SQL SET TRANSACTION NAME t1 READ WRITE;
Tip:
It is good programming practice to specify the access mode of a transaction, even when it is
It is good programming practice to specify the access mode of a transaction, even when it is
READ WRITE
. It makes an application’s source code easier to read and debug because the intentions of the program are clearly spelled out.Start a transaction for READ ONLY access when you only need to read data. READ ONLY
must be specified. For example, the following statement starts a transaction, t1
, for read-only access:
EXEC SQL SET TRANSACTION NAME t1 READ ONLY;