[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'SQLDB' (#fcl)

# TSQLScript.UseDefines

Automatically handle pre-processor defines

## Declaration

Source position: sqldb.pp line 756

`published property TSQLScript.UseDefines;`

## Description

UseDefines will automatically register the following pre-processing directives:

    #IFDEF
    #IFNDEF
    #ELSE
    #ENDIF
    #DEFINE
    #UNDEF
    #UNDEFINE

Additionally, these directives will be automatically handled by the TSQLScript component. This can be used to add conditional execution of the SQL script: they are treated as the conditional compilation statements found in the C macro preprocessor or the FPC conditional compilation features. The initial list of defined macros can be specified in the Defines property, where one define per line can be specified.

In the following example, the correct statement to create a sequence is selected based on the presence of the macro FIREBIRD in the list of defines:

    #IFDEF FIREBIRD
    CREATE GENERATOR GEN_MYID;
    #ELSE
    CREATE SEQUENCE GEN_MYID;
    #ENDIF

## See also

TSQLScript.Script |  | The script to execute
TSQLScript.Defines |  | Defined macros

Documentation generated on: May 14 2021