SQLPrepare - cBaseSQLExecutor

Prepares a query without executing it

Type: Procedure

Parameters: String sSqlQuery

ParameterDescription
sSqlQuerySQL Query


Syntax
Procedure SQLPrepare String sSqlQuery

Call: Send SQLPrepare sSqlQuery


Description

Prepares a query without executing it.

Sample

Prepare a query.

Send SQLPrepare of ghoSQLExecutor @SQL"SELECT
    Name,  
    City,
    Zip
    FROM Customer"

// Test for errors
If (not(Err)) Begin
    // Execute the query here..
End


Call SQLExecute to execute a prepared SQL query. SQLExecute can be used in two ways, with or without a result set.

Sample

Example of SQLExecute with result set.

String[][] aResults 

// Fetch results into aResults
Get SQLExecDirect of ghoSQLExecutor @SQL"SELECT
    Name,  
    City,
    Zip
    FROM Customer" to aResults

// Test for errors
If (not(Err)) Begin
    // Process results here..
End


Sample

Example of SQLExecute without a result set.

Integer iAffectedRows

Send SQLExecDirect of ghoSQLExecutor @SQL"UPDATE Customer
    SET NAME = 'Thomas Hardy', City = 'London'  
    WHERE Customer_Number = 1"

// Test for errors
If (not(Err)) Begin
    Get piSQLAffectedRows of ghoSQLExecutor to iAffectedRows
End

See Also

Function SQLExecute | Procedure SQLExecute