SQL keyword protection and the dollar sign ($) symbol
All SQL statements within source files
can either begin with the EXEC SQL key words or with the $ prefix.
All of the following pairs of statements are equivalent:
EXEC SQL BEGIN DECLARE SECTION;
$BEGIN DECLARE SECTION;
EXEC SQL connect to ‘database9’;
$connect to ‘database9’;
EXEC SQL select fname into :hostvar1 from table1;
$ select fname into :hostvar1 from table1;
However, the $ symbol can also occur at the beginning of typedef definitions
such as in the following example:
$int *ip = NULL;
In cases such as the preceding typedef example, program
logic might require that the C preprocessor substitute the value zero
in the place of the keyword NULL. Not allowing the C preprocessor
to make value substitutions in such cases would lead to errors. Therefore,
the eprotect utility does not add a prefix to the SQLKEYWORD_ prefix
on SQL keywords that are displayed in SQL statements that begin with
the dollar sign ($) symbol.
Important: If you want to
run the C preprocessor on your source file before
the preprocessor,
and if you do not want the C preprocessor to substitute values for
the SQL keywords in SQL statements that occur in your source file,
you must begin each SQL statement with the keywords EXEC SQL, and
not with the dollar sign ($) symbol.