ALLBASE/SQL Reference Manual (36216-90216)

94 Chapter2
Using ALLBASE/SQL
Application Programming
Authorization
ALLBASE/SQL authorization governs who can preprocess and execute a program that
accesses a DBEnvironment as described here:
•To
preprocess
a program, you need DBA or CONNECT authority and the authorities
needed to execute all activities against the database that are executed by the program.
The module stored for the program is owned by the login name of the individual who
invokes the preprocessor. A DBA, however, can associate the module with a different
owner at preprocessing time. Other users can assign a group name as the module owner
if they belong to the group.
•To
run
a program, you need either RUN authority or OWNER authority for the stored
module. You also need the authority to start the DBE session as it is started in the
program.
DBEnvironment Changes
Certain DBEnvironment changes can affect preprocessed programs. For example, one of
the tables used by the program can be dropped from a database, or the authorities held by
the module's owner can change. When you run a preprocessed program, ALLBASE/SQL
automatically determines whether changes such as these have occurred. If any have,
ALLBASE/SQL attempts to revalidate the affected sections. The only SQL statements that
are executed at run time are those that operate on existing objects and those which the
module's owner is authorized to execute.
Some changes do not affect successful execution of the program, but others can. If, for
example, the owner of the program had SELECT and UPDATE authority for a table updated
by the program and the UPDATE authority is later revoked, the program is no longer able to
update that table. But if SELECT authority is revoked instead, the UPDATE statements for
the table can still execute successfully.
Host Variables
Data is passed back and forth between a program and ALLBASE/SQL in host variables.
SQL statements use both input and output host variables. Input host variables are used to
transfer data into ALLBASE/SQL from the application. Output host variables move
information from ALLBASE/SQL into the application.
An indicator variable is a special type of host variable. In the SELECT, FETCH, UPDATE,
UPDATE WHERE CURRENT, and INSERT statements, the indicator variable is an input host
variable whose value depends on whether an associated host variable contains a null
value. If the indicator variable contains a negative number, then the associated host
variable is null. If it contains a zero or positive number, the value in the host variable is
not null.
In the SELECT and FETCH statements the indicator variable can be an output host variable
and indicate that a value in the associated host variable is null or a column value is
truncated. Host variable names are prefixed with a colon (:) when embedded in an SQL
statement.
:PartNumber
:PartName