Example 1
Ready a relation with defaults:
START_TRANSACTION READ_WRITE
This statement allows access to all the relations in the current
database so that all users can modify records. It is equivalent
to readying all the relations for the SHARED WRITE reserving
option.
Example 2
Start a read-only transaction:
START_TRANSACTION READ_ONLY
This statement lets you read data from the database but not store
or modify data. When you retrieve data, you see the state of
the records as they existed at the time of the START_TRANSACTION
statement. You do not see any updates to the database made after
that time.
Example 3
Start a transaction with locked relations:
The following statement lets you specify the intended action for
each relation in the transaction.
START_TRANSACTION READ_WRITE RESERVING
EMPLOYEES FOR PROTECTED WRITE,
JOBS, SALARY_HISTORY FOR SHARED READ
Assume that this transaction updates the EMPLOYEES relation based
on values found in two other relations, JOBS and SALARY_HISTORY:
o The transaction must update EMPLOYEES, so EMPLOYEES is readied
for the PROTECTED WRITE option.
o The program will only read values from JOBS and SALARY_
HISTORY, so there is no need for PROTECTED or WRITE access.
However, you do intend to update records in the transaction,
so the read-only transaction mode is not appropriate.
Example 4
In the following example, the user [SQL,HALSTON] receives the
READ, WRITE, MODIFY, and ERASE rights. HALSTON also gets the
DISTRIBTRAN right, which allows HALSTON to run the two-phase
commit protocol on the current database.
RDO> DEFINE PROTECTION FOR DATABASE
cont> POSITION 2
cont> IDENTIFIER [SQL,HALSTON]
cont> ACCESS "READ+WRITE+MODIFY+ERASE+DISTRIBTRAN".
RDO>
RDO> SHOW PROTECTION FOR DATABASE
(IDENTIFIER=[SQL,RICK],ACCESS=READ+WRITE+MODIFY+ERASE+SHOW+DEFINE+
CHANGE+DELETE+CONTROL+OPERATOR+ADMINISTRATOR+REFERENCES+SECURITY+
DISTRIBTRAN)
(IDENTIFIER=[SQL,HALSTON],ACCESS=READ+WRITE+MODIFY+ERASE+DISTRIBTRAN)
(IDENTIFIER=[*,*],ACCESS=NONE)
Example 5
The following START_TRANSACTION statement starts a read/write
transaction reserving the EMPLOYEES table for shared read. Note
that the SHOW TRANSACTION statement shows that fast commit is
enabled for the database.
RDO> START_TRANSACTION READ_WRITE RESERVING
cont> EMPLOYEES FOR SHARED READ
RDO> SHOW TRANSACTION
All Transactions in Database with filename MF_PERSONNEL
a read-write transaction is in progress
- updates have not been performed
- fast commit is enabled
- transaction sequence number (TSN) is 121
- snapshot space for TSNs less than 121 can be reclaimed
- session ID number is 42