HPlogo Getting Started with HP IMAGE/SQL: HP 3000 MPE/ iX Computer Systems > Chapter 3 Moving from TurboIMAGE/XL to IMAGE/SQL

Methods of Accessing Databases

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

TurboIMAGE/XL and IMAGE/SQL both offer a variety of tools for accessing databases and both provide techniques for concurrency control, which regulates access by more than one user at a time.

Interactive Access

TurboIMAGE/XL interactive access is through Query/3000, which lets you find database entries and report on them using the Query command language. In IMAGE/SQL, the interactive interface is known as ISQL, which uses Structured Query Language (SQL) to access the database and display query results.

Programmatic Access

A major difference between TurboIMAGE/XL and IMAGE/SQL is in the programmatic interface. TurboIMAGE/XL provides a set of intrinsics that you use in application programs to open databases, obtain locks, retrieve data, unlock data items and data sets, and close a database.

IMAGE/SQL uses embedded SQL programming. You insert standard SQL statements in an application program, then you preprocess the program to convert the SQL statements into valid procedure calls in the language you are using. The converted code is compiled and linked with a library of IMAGE/SQL routines. You can prototype and test your queries in ISQL before using them in an application, thus saving development time. Embedded SQL also includes a set of dynamic statements that let your end users perform queries, inserts, updates, and deletes through your applications.

Locking Mechanisms

In TurboIMAGE/XL, you use the DBLOCK intrinsic in certain access modes to provide locking at the database level, the data set level, or the data item level. Locking must be explicitly requested by the user; it is required for concurrent updates. You can request locks conditionally in TurboIMAGE/XL, which means that the call returns if the lock request fails.

In IMAGE/SQL, locking is provided when:

  • it is implicitly specified when the data is accessed (such as when inserting, deleting, or updating.) The whole data set is locked until the end of the transaction. For example,

            
    
            BEGIN WORK
    
    
    
            SELECT * FROM Turbo.Dataset
    
    
    
            DELETE FROM Turbo.Dataset      <-----  LOCK begins
    
                WHERE Mynumber=25
    
    
    
            SELECT * FROM Turbo.Dataset 
    
              
    
            COMMIT WORK                    <-----  UNLOCK occurs
    
    
    

  • it is explicitly specified by the LOCK TABLE statement.

Locking is unconditional and applies at the table level; row and page level locking is not supported. Refer to the ALLBASE/SQL Reference Manual for more details.

Feedback to webmaster