Script handling

<< Transaction handling | Firebird Interactive SQL Utility | isql commands >>

Script handling

A batch of DDL and/or DML statements in a text file is known as a script. Scripts can be used to create and alter database objects. These are referred to as Data Definition Language (DDL) scripts. Scripts that manipulate data by selecting, inserting, updating, deleting or performing data conversions, are called Data manipulation Language (DML) scripts.

One of the most important tasks handled by isql is to process scripts. It can handle both DDL and DML Scripts, but they should be included in separate scripts to avoid data integrity problems. This script processing feature of isql allows the linking of one script to another using the isql command INPUT <filespec>. Scripts statements are executed in order that they appear in the script file. The default setting in isql for AUTODDL is set to ON.

You may use the SET AUTODDL command to control where or when statements will be committed.

Note: The AUTODDL setting only affects DDL statements. It doesn't commit DML statements. If you mix DDL and DML statements within the same interactive session, then the AUTODDL commits do not commit your DML transactions. For example:

 SQL> set autoddl on;

 SQL> insert into test(a) values (666);
 SQL> commit;

 SQL> select * from test;

            A
 ============
          666

 SQL> insert into test(a) values (999);
 SQL> select * from test;

            A
 ============
          666
          999

 SQL> create table another_test(b integer);
 SQL> rollback;

 SQL> select * from test;

            A
 ============
          666

Scripts can redirect their output to a log file using the OUTPUT file_name command. This can be entered directly at the isql prompt, or as part of a script file itself.

back to top of page
<< Transaction handling | Firebird Interactive SQL Utility | isql commands >>