Difference between revisions of "SQLPREPARE()"

From Lianjapedia
Jump to: navigation, search
Line 6: Line 6:
  
 
==See Also==
 
==See Also==
[[CREATE CONNECTION]], [[SQLCANCEL()]], [[SQLCOLUMNS()]], [[SQLCOMMIT()]], [[SQLCONNECT()]], [[SQLDISCONNECT()]], [[SQLERROR()]], [[SQLEXEC()]], [[SQLGETPROP()]], [[SQLMORERESULTS()]], [[SQLROLLBACK()]], [[SQLSETPROP()]], [[SQLSTRINGCONNECT()]], [[SQLTABLES()]]
+
[[SQLCANCEL()]], [[SQLCOLUMNS()]], [[SQLCOMMIT()]], [[SQLCONNECT()]], [[SQLDISCONNECT()]], [[SQLERROR()]], [[SQLEXEC()]], [[SQLGETPROP()]], [[SQLMORERESULTS()]], [[SQLROLLBACK()]], [[SQLSETPROP()]], [[SQLSTRINGCONNECT()]], [[SQLTABLES()]]
  
 
==Description==
 
==Description==
Line 50: Line 50:
 
</code>
 
</code>
  
==Products==
 
Lianja, Lianja Server
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]

Revision as of 12:47, 12 December 2012

Purpose

Prepare an SQL statement that will be executed by the SQLEXEC() function

Syntax

SQLPREPARE(<nStatementHandle>, <cSQLCommand> [, <cCursorName>])

See Also

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