|
|
| Client Application Variables in the SQL Statements | Ways to Use the SQL Language | Dynamic SQL Statements in Stored Procedures |
The 602SQL database client may execute SQL statements in two different ways:
SQL_execute function that passes the statement to be executed to the server.SQL_prepare or cd_SQL_host_prepare function to pass the statement to the server. Next, execute the statement using the SQL_exec_prepared function. Finally, discard the preparation using the SQL_drop function.The direct method is the easiest for the client. A call to a single function invokes a complete process of an SQL statement.
The prepared SQL statement is mainly used to save time. If the same statement (eventually with different parameter values) is executed repeatedly, the SQL server completely analyzes the statement during the preparation and designs an optimized plan for execution. Each consecutive call to the SQL_exec_prepared function will execute the optimized plan. The SQL_drop deletes the plan that is no longer needed.
The client may have multiple prepared statements and may execute them in any order.
If you call the Set_application function, all previously prepared statements will be dropped and their handles will be invalid.
| Client Application Variables in the SQL Statements | Ways to Use the SQL Language | Dynamic SQL Statements in Stored Procedures |