SQLExecute - cSQLStatement
Executes a prepared statement
Type: Procedure
Syntax
Procedure SQLExecute
Call Example
Send SQLExecute
Description
The SQLExecute procedure executes a prepared statement.
Prepared execution is an efficient way to execute a query more than once. Preparing a statement will create the statement's access plan. Calling SQLExecute will execute the prepared statement. Prepared execution is faster than direct execution for statements executed more than once, primarily because the access plan is only created once.
See Parameterized Queries for more information on parametrized queries and prepared execution.
Resets piLastArgument to 0.
Sample
Handle hoSQLMngr hdbc hStmt
Integer iFetchResult
String sName sState
Object oSQLHandler is a cSQLHandleManager
Move Self to hoSQLMngr
End_Object
Open Customer
Get SQLFileConnect of hoSQLMngr Customer.File_number to hdbc
Get SQLOpen of hdbc to hStmt
Send SQLExecute of hStmt "select Name, State from customer"
Repeat
Get SQLFetch of hStmt to iFetchResult
If (iFetchResult <> 0) Begin
Get SQLColumnValue of hStmt 1 to sName
Get SQLColumnValue of hStmt 2 to sState
End
Until (iFetchResult = 0)
Send SQLClose of hstmt
Send SQLDisconnect of hdbc