![HP NonStop SQL/MP Programming Manual Download Page 53](http://html.mh-extra.com/html/hp/nonstop-sql-mp/nonstop-sql-mp_programming-manual_165149053.webp)
Host Variables
HP NonStop SQL/MP Programming Manual for C—429847-008
2-19
Advantages of Using an INVOKE Directive
To run an INVOKE directive, a process started by the program must have read access
to the invoked tables or views during C compilation. For details, see
Required
Access Authority
on page 7-1.
The
CHAR_AS_STRING
and
CHAR_AS_ARRAY
options of the
SQL
pragma affect the
INVOKE directive as follows:
The
CHAR_AS_STRING
option (the default) causes INVOKE to generate character
data types with an extra byte for a null terminator.
The
CHAR_AS_ARRAY
option causes INVOKE to generate character data types
without the extra byte for a null terminator.
Advantages of Using an INVOKE Directive
You can declare a host variable as a C structure corresponding to an SQL table or
view without using an INVOKE directive. However, using an INVOKE directive to
generate host variables has these advantages:
Program independence––If you modify a table or view, the INVOKE directive
re-creates the host variables to correspond to the new table or view when you
recompile the program. (You must, however, modify a program that refers to a
deleted column or must access a new column.)
TACL DEFINEs––The INVOKE directive accepts a class MAP DEFINE name for a
table or view name (but not for a structure tag).
Program performance––The INVOKE directive maps SQL data types to the
corresponding C data types. No data conversion is required at run time.
Program readability and maintenance––The INVOKE directive creates host
variables using the same names as column names in the table or view and
generates comments that show the table or view name and the time and date of
the definition.
C Structures Generated by the INVOKE Directive
These examples show the correspondence between tables TYPESC1 and TYPESC2
that contain columns of various SQL data types and the C structures generated by the
INVOKE directive.
Example 2-2
on page 2-20 shows the CREATE TABLE statements
that generate the tables, and
Example 2-3
on page 2-21 shows the structures
generated by the INVOKE directives.
Summary of Contents for NonStop SQL/MP
Page 4: ......
Page 14: ...Contents HP NonStop SQL MP Programming Manual for C 429847 008 x ...
Page 60: ...Host Variables HP NonStop SQL MP Programming Manual for C 429847 008 2 26 VARCHAR Data Type ...
Page 294: ...SQL MP Sample Database HP NonStop SQL MP Programming Manual for C 429847 008 A 6 ...