Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
HP.com home
Jazz home  >  Papers & Training

IMAGE/SQL: Issues and answers concerning SQL tables

» 

Jazz home

»

Software

»

Papers & Training

»

Java

»

HP Partners

»

News & Events

»

Register for more info

Content starts here
Prev Page Next Page Manual Top Home Page


5.2 TurboIMAGE locking: mode 1 user without an SQL predicate



  • Question: What happens when a MODE 1 user READS from a TurboIMAGE data set without providing an SQL predicate?

    Answer: The isolation level of the transaction affects whether or not locks are acquired:

    • If the isolation level is RU (Read Uncommitted), no locks are acquired.
    • If the isolation level is anything except for RU, a lock is obtained on the entire data set.

  • Question: What happens when a MODE 1 user WRITES to a TurboIMAGE data set without providing an SQL predicate?

    Answer: A lock is always obtained on the entire data set.


Reading from a data set without a predicate selects all rows



NOTE that each of the above SELECT statements does not contain a WHERE clause, so all rows in each data set will be returned. The most efficient way to lock all rows is to lock the entire data set.

Key points


  • A MODE 1 user has the capability to both read and write TurboIMAGE data.

  • When a SELECT statement does not contain a WHERE clause, all rows in the data set qualify. The isolation level of the transaction affects the locks that are obtained on the data set:

    • If the isolation level is RU (Read Uncommitted), locks are not acquired when the transaction reads data. RU is the weakest isolation level. An RU transaction can read rows that another transaction is actively modifying, even though the other transaction may eventually decide to issue a ROLLBACK WORK and cancel its changes.

    • If the isolation level is RR (Repeatable Read), rows that are read cannot be modified by another transaction until the RR transaction ends. RR is the strongest isolation level. An RR transaction can read a row (that it has already read once) for a second (or third, etc.) time, and the information returned for the second read will be identical to the information that was returned for the first read. Hence, reads are repeatable.

      ALLBASE/SQL has five different types of locks - the most important are S (share) and X (exclusive). S locks improve the concurrency of RR transactions. When data is locked with an S lock, no other transaction may modify it but other transactions are allowed to read it. An X lock prevents access by any other user.

      Today, TurboIMAGE only has one type of lock, which is equivalent to an X lock in ALLBASE/SQL. The only way for TurboIMAGE to guarantee that the data read by an RR transaction will not change is to lock it exclusively. Unfortunately, this negatively affects the concurrency of other RR transactions, especially those who simply need to read the data.

    • The CS (Cursor Stability) and RC (Read Committed) isolation levels are not really implemented in TurboIMAGE. Today, they simply act like RR.

    • SQL isolation levels are described in more detail later in this chapter.

Writing to a data set without a predicate selects all rows



NOTE that the above UPDATE statement does not contain a WHERE clause, so all rows in the data set will be modified. The most efficient way to lock all rows is to lock the entire data set.

Key points


  • When an UPDATE or DELETE statement does not contain a WHERE clause, all rows in the data set qualify. A lock is always obtained on the entire data set.

Prev Page Next Page Manual Top Home Page

Page last updated on November 29, 1995

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2004 Hewlett-Packard Development Company, L.P.