Script Language Extentions.
Besides standard set of DDL commands Interbase/Firebird Development Studio supports a set of extended
commands that allows you to control script execution flow based on conditions and even database state.
The ability to include external files also increases the script management possibilities. Script execution
control commands must be in comment pairs and begins from $: /*$include somefile.sql
*/. Here is the full list of available commands:
-
INCLUDE - includes external file and executes it as a part of script. Example: /*$include
myfile.sql*/
-
SET <variable name>=<value> - defines new variable and set value to it. If the variable
was already defined this command will only change the value of the variable. Varible names are case-insensitive.
String values must be in a double-quotes. Example: /*$set MyVar="ABCDEF"*/ or /*set
Var1=123*/
-
SET select <field1>... <fieldN> from <table> into <variable 1>, <variable
2> - defines variables as a result of the select from the database. Example: /*$set
select F1,F2 from MyTable into Var1,Var2*/
-
IF <condition> - the script statements after this clause will be executed only if the condition
is true.
<condition>={<variable 1><operator><variable 2>|<variable><operator><value>}
<operator>= {= | < | > | >= | <= | <> }
Example: /*$IF SystemVersion>=10 */
-
IFEXISTS {TABLE|VIEW|PROCEDURE|TRIGGER|DOMAIN|GENERATOR|EXCEPTION|UDF} <ObjectName> - checks
the availability of the specified object in a database.
Example: /*$IFEXISTS TABLE JOB */
-
IFNEXISTS or IFNOTEXISTS - the negative value of IFEXISTS.
-
ELSE - any block of IF may contain ELSE. Any statements between ELSE and ENDIF will be executed
when condition is false.
-
ENDIF - Any block of $IF,$IFEXISTS,$IFNOTEXISTS commands must be ended with ENDIF.
Firebird 2.0 introduces COMMENT command that allows to set descriptions for database objects. IBStudio
supports this useful command for any version of Interbase and Firebird servers. The syntax of this command
is:
COMMENT ON <basic_type> name IS 'description';
COMMENT ON COLUMN tblviewname.fieldname IS 'description';
COMMENT ON PARAMETER procname.parname IS 'description';
where <basic_type> is:
DOMAIN
TABLE
VIEW
PROCEDURE
TRIGGER
EXTERNAL FUNCTION
FILTER
EXCEPTION
GENERATOR