Introduction to Data Management
Accessing Databases With NonStop SQL
15873 Tandem Computers Incorporated 3-21
Another advantage is automatic recompilation. At runtime, the SQL executor
determines whether the object program file is consistent with the latest version of the
database dictionary. If the object program file is not consistent, the executor directs
the SQL compiler to recompile the program automatically, assuring programmers that
their SQL statements always apply to the current database. SQL compilation takes
advantage of the current state of the dictionary to optimize access paths and speed
program execution.
Still another advantage, mentioned earlier, allows you to see the results of an SQL
statement execution without compiling and executing your program. You just enter
the statement through SQLCI. The statement will then execute just as it would within
your program. In addition, after execution of a statement to select data, you can
display statistics that show the number of records selected, the estimated cost of the
operation, the time taken to perform the operation, and the number of disk reads
performed on the table.
NonStop SQL provides a WHENEVER directive to help your programs handle errors
or other exceptional conditions. Through this directive, you can indicate the action to
take whenever an SQL error or warning occurs, or whenever a selected row cannot be
found or the end of a table is reached. This directive remains in effect until you
override it with a new directive. Thus you can apply a WHENEVER directive to one
statement or to many. The SQL preprocessor adds the necessary host-language
statements to your program to support the WHENEVER directive. You, of course,
must include the procedures to execute if an error occurs or a row is not found.
If your application runs in a PATHWAY environment, you can use PATHMAKER to
generate requester screens from a NonStop SQL database and to generate a skeleton
server from NonStop SQL code. Using PATHMAKER with NonStop SQL is similar to
using it to generate any PATHWAY application; you supply PATHMAKER with the
data it needs to generate a requester, to generate the services required by that
requester, and to package the services into a server. More about this kind of
application generation appears in Section 5.