HP 3000 Manuals

The Stored Section [ ALLBASE/SQL FORTRAN Application Programming Guide ] MPE/iX 5.0 Documentation


ALLBASE/SQL FORTRAN Application Programming Guide

The Stored Section 

A section consists of ALLBASE/SQL instructions for executing an SQL
command.  The preprocessor creates a section and assigns a unique section
number for all embedded ALLBASE/SQL commands in a module except:

          BEGIN DECLARE SECTION          OPEN
          BEGIN WORK                     PREPARE
          CLOSE                          RELEASE
          COMMIT WORK                    ROLLBACK WORK
          CONNECT                        SAVEPOINT
          DECLARE                        START DBE
          DELETE WHERE CURRENT           STOP DBE
          END DECLARE SECTION            SQLEXPLAIN
          EXECUTE                        TERMINATE USER
          EXECUTE IMMEDIATE              UPDATE WHERE CURRENT
          FETCH                          WHENEVER
          INCLUDE

Purpose of Sections 

A section serves two purposes:

   *   Access validation:  Before executing a stored section at runtime,
       ALLBASE/SQL ensures that any objects referenced exist and that
       runtime authorization criteria are satisfied.

   *   Access optimization:  If ALLBASE/SQL has more than one way to
       access data, it determines the most efficient method and creates
       the section based on that method.  Indexes, for example, can
       expedite the performance of some queries.

By creating and storing sections at preprocessing time rather than at
runtime, you improve runtime performance.

Section Validity 

A section is assigned one of two states at preprocessing time:  valid or
invalid.  A section is valid when access validation criteria are
satisfied.  If the SQL command references objects that exist at
preprocessing time and the individual doing the preprocessing is
authorized to issue the command, the stored section is marked as valid.
A section is invalid when access validation criteria are not satisfied.
If the SQL command references an object that does not exist at
preprocessing time or if the individual doing the preprocessing is not
authorized to issue the command, the stored section is marked as invalid.
After being stored by the preprocessor, a valid section is marked as
invalid when such activities as the following occur:

   *   Changes in authorities of the module's owner.

   *   Alterations to tables accessed by the program.

   *   Deletions or creations of indexes.

   *   Updating a table's statistics.

At runtime, ALLBASE/SQL executes valid sections and attempts to validate
any sections marked as invalid.  If an invalid section can be validated,
as when an altered table does not affect the results of a query,
ALLBASE/SQL marks the section as valid and executes it.  If an invalid
section cannot be validated, as when a table reference is invalid because
the table owner name has changed, ALLBASE/SQL returns an error indication
to the application program, which in turn can determine what to do.

When a section is validated at runtime, it remains in the valid state
until an event that invalidates it occurs.  Program execution during
which validation occurs is slightly slower than program execution
following section validation.



MPE/iX 5.0 Documentation