f2s_scripting_mode

Applies to: Oracle, MS SQL, MySql/MariaDB, PostgreSQL Drivers

Syntax

set_attribute f2s_scripting_mode {DriverID} to {variable}
get_attribute f2s_scripting_mode {DriverID} to {variable}

Parameter

Description

DriverID

The ID of the driver for which this applies. In most cases, you should use _f2s_ActiveDriverID.

variable

Boolean variable. If true, scripting mode is on, otherwise off.

Description

Scripting is used for testing and preparation. Using this attribute allows structural changes to be compiled and tested without actually making any of the changes. Any table restructuring (Structure_start/Structure_end) done between the set_attribute f2s_scripting_mode to true and set_attribute f2s_scripting_mode to false (f2s_scripting_mode block) will not actually be committed but instead will create a mock INT file and an SQL script to make the changes to the table. The script and INT file can then be retrieved (commands f2s_get_sql_script and f2s_get_int) and examined for testing purposes.

Getting this attribute returns a boolean indicating whether scripting mode is on (true) or off (false).

Examples

get_attribute

boolean bAmScripting

get_attribute f2s_scripting_mode to bAmScripting

set_attribute

In this example scripting is used to add a date field, Start_Date, to the VDFOrders table, SalesPerson. Note, an SQL script to add the field and the resulting INT file will be produced, however no changes to the table will be made.

Handle hSales
Variant sPart
UChar [] INTFile
UChar [] SQLScript
Integer iNewColumn

Move salesperson.File_Number to hSales

Set_Attribute f2s_scripting_mode of _f2s_ActiveDriverID  to True
Structure_Start hSales
    Boolean bOn
    Move 0 to iNewColumn
    Create_Field hSales at iNewColumn
    Set_Attribute DF_FIELD_NAME of hSales iNewColumn to "Start_Date"
    Set_Attribute DF_FIELD_TYPE of hSales iNewColumn to DF_DATE
Structure_End hSales
Set_Attribute f2s_scripting_mode of _f2s_ActiveDriverID  to False

Open SalesPerson

f2s_get_int INTFile
f2s_get_sql_script SQLScript

Showln (UCharArrayToString(SQLScript))

Related Attributes

  • f2s_get_sql_script

  • f2s_get_int

Replaces: Commands DISABLE_SCRIPTING and ENABLE_SCRIPTING