Conditional Compilation

Conditional Compilation uses Macros to decide whether to include or exclude blocks of code from being executed; a typical usage of this is to enable/disable debug code.


${ifdef [!]macro-name} [data]

Conditionally executes code if macro-name is defined; if the exclamation mark is included before the macro-name then the code will only be executed if the macro-name is not defined.  If data is given, then the ifdef command is an inline command, otherwise it becomes a grouped command and must be paired with a corresponding endif.

--${ifdef DEBUG} this is an inline ifdef
--$(ifdef DEBUG}
    this is a grouped ifdef
--${endif}

In this example, if the macro DEBUG is defined then the code output by SQL Explorer will be:

this is an inline ifdef
this is a grouped ifdef


${else} [data]

Counterpart to a grouped ifdef command; if data is provided then it is an inline command, otherwise it is a grouped command that must be paired with a corresponding endif.  For example:

--$(ifdef DEBUG}
    in debug mode
--${else}
    not in debug mode
--${endif}


${endif}

Closes a grouped ifdef.