Difference between revisions of "SQLPREPARE()"

From Recital Documentation Wiki
Jump to: navigation, search
(Products)
Line 59: Line 59:
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital, Recital Server
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:SQL]]
 
[[Category:SQL]]

Revision as of 17:27, 7 December 2009

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(), 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