Updated on 2024-05-07 GMT+08:00

Directives: ifdef, ifndef, else, elif, and endif

ecpg provides ifdef, ifndef, else, elif, and endif conditional compilation instructions. During preprocessing, different parts of the program are compiled based on different conditions. When using the program, you need to add the EXEC SQL prefix keyword.

Example:
EXEC SQL ifndef TZVAR; 
EXEC SQL SET TIMEZONE TO 'GMT'; 
EXEC SQL elif TZNAME; 
EXEC SQL SET TIMEZONE TO TZNAME; 
EXEC SQL else; 
EXEC SQL SET TIMEZONE TO TZVAR; 
EXEC SQL endif;