f2s_esql_prepare_stmt

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

Syntax

ff2s_esql_prepare_stmt  [using {variant}]

Parameter

Description

variant

Optional variant type variable that will receive a statement interface.

Description

This command prepares a statement, procedure or function for processing. Once invoked the database will then parse, compile and create an execution plan for the SQL template that is provided, but execution will not run until it is executed.

When executing a SQL statement, the actual execution of the will not be preformed until the optional parameters are set with the f2s_esql_set_param commands, all optional f2s_esql_append_stmt commands and the f2s_esql_execute_stmt command are called.

The optional “using” syntax allows you to pass around the interface created by this command. The variable passed MUST be a variant. This allows for multiple statements to be active concurrently in some cases. If you use the “using” syntax, it must be used on all subsequent commands. Mixing the using syntax is not supported. So for instance, if you plan on having multiple statements active concurrently, all active statements must make use of the using syntax.

Example

_ff2s_esql_prepare_stmt Command
 Variant[] vRow
 f2s_esql_create_stmt "select * from orderheader where SalesPerson_ID = ?"
 f2s_esql_prepare_stmt
 f2s_esql_set_param 1 to "NONE"
 f2s_esql_execute_stmt
 f2s_esql_move_next
 While (Found)
     f2s_esql_get_row vRow
     Showln (SFormat("First Column: %1 Second Column:  %2",vRow[0], vRow[1]))
     f2s_esql_move_next
 Loop
 f2s_esql_close_stmt

Related Commands

Replaces: Command SQL_PREPARE_STMT