Difference between revisions of "SQLPREPARE()"

From Lianjapedia
Jump to: navigation, search
m (Text replace - "Recital" to "Lianja")
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Prepare an SQL statement that will be executed by the SQLEXEC() function
 
Prepare an SQL statement that will be executed by the SQLEXEC() function
 
  
 
==Syntax==
 
==Syntax==
 
SQLPREPARE(<nStatementHandle>, <cSQLCommand> [, <cCursorName>])
 
SQLPREPARE(<nStatementHandle>, <cSQLCommand> [, <cCursorName>])
 
  
 
==See Also==
 
==See Also==
 
[[CREATE CONNECTION]], [[SQLCANCEL()]], [[SQLCOLUMNS()]], [[SQLCOMMIT()]], [[SQLCONNECT()]], [[SQLDISCONNECT()]], [[SQLERROR()]], [[SQLEXEC()]], [[SQLGETPROP()]], [[SQLMORERESULTS()]], [[SQLROLLBACK()]], [[SQLSETPROP()]], [[SQLSTRINGCONNECT()]], [[SQLTABLES()]]
 
[[CREATE CONNECTION]], [[SQLCANCEL()]], [[SQLCOLUMNS()]], [[SQLCOMMIT()]], [[SQLCONNECT()]], [[SQLDISCONNECT()]], [[SQLERROR()]], [[SQLEXEC()]], [[SQLGETPROP()]], [[SQLMORERESULTS()]], [[SQLROLLBACK()]], [[SQLSETPROP()]], [[SQLSTRINGCONNECT()]], [[SQLTABLES()]]
 
  
 
==Description==
 
==Description==
Line 15: Line 12:
  
 
The SQLPREPARE() function operates on the data source specified by <nStatementHandle>.
 
The SQLPREPARE() function operates on the data source specified by <nStatementHandle>.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 27: Line 23:
 
|-
 
|-
 
|}
 
|}
 
  
 
====Return values:====
 
====Return values:====
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 40: Line 34:
 
|-
 
|-
 
|}
 
|}
 
  
 
==Example==
 
==Example==

Revision as of 11:16, 11 December 2012

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

Lianja, Lianja Server