SQLPREPARE()
From Recital Documentation Wiki
Purpose
Prepare an SQL statement that will be executed by the SQLEXEC() function
Syntax
SQLPREPARE(<nStatementHandle>, <cSQLCommand> [, <cCursorName>])
See Also
CREATE CONNECTION, SQLCANCEL(), SQLCOLUMNS(), SQLCOMMIT(), SQLCONNECT(), SQLDISCONNECT(), SQLERROR(), SQLEXEC(), SQLGETPROP(), SQLMORERESULTS(), SQLROLLBACK(), SQLSETPROP(), SQLSTRINGCONNECT(), SQLTABLES()
Description
The SQLPREPARE() function is used to prepare an SQL statement which will subsequently be executed by the SQLEXEC() function on the specified data source.
The SQLPREPARE() function operates on the data source specified by <nStatementHandle>.
Keywords | Description |
---|---|
nStatementHandle | The workarea in which the gateway data source is open. |
cSQLCommand | The SQL statement to be passed to the data source. |
cCursorName | The name of the cursor to use. If cCursorName is not specified, the default name SQLRESULT is used. |
Return values:
Return Value | Description |
---|---|
1 | SQLPREPARE() successful |
–1 | Connection error |
Example
nStatHand=SQLSTRINGCONNECT("rec@rec1:user1/pass1-/usr/recital/uas/data/southwind.tcpip",.T.) if nStatHand < 1 messagebox('Cannot make connection', 16, 'SQL Connect Error') else messagebox('Connection made', 48, 'SQL Connect Message') store "00010" to myVar SQLPREPARE(nStatHand, "SELECT * FROM example WHERE account_no = ?myVar", "restab") SQLEXEC(nStatHand) browse SQLDISCONNECT(nStatHand) endif
Products
Recital, Recital Server