<<

Contents

Search

>>

 

JDBC_SETPARAM

 

 

Function

 

 

Syntax:

JDBC_SETPARAM(<File Number>,<Value>[,<Number of Parameter>])

 

<File Number>

= <NUM-EXPRESSION>

<Value>

= <STRING-EXPRESSION>

<Number of Parameter>

= <NUM-EXPRESSION>

 

 

Meaning:

Substitutes placeholders ? with values.

 

Every placeholder must be filled with a JDBC_SETPARAM call, otherwise errors will occur with JDBC_EXEC_PREPARED .

 

Placeholders are needed especially when quotation marks or other control characters appear with data fields in the SQL command. JDBC would then interpret these characters as parts of a command.

JDBC_SETPARAM fills the placeholder no. <Number of Parameter> of the last executed JDBC_PREPARE command with the content of <Value>.

 

If <Number of Parameter> <= 0 or if the parameter is missing, the next placeholder (based on the last JDBC_SETPARAM) is replaced.

 

JDBC_SET_PARAM returns the result 0 if no error occurred, otherwise –1. 

 

If an error occurs, the variable OK contains the error number and the function JDBC_GET_LAST_ERROR$ returns the error text.

 

Parameter:

File Number

Number of JDBC database

Value

Value

Number of Parameter

Number of parameter

 

Sample:

H% = JDBC_PREPARE(2,"select * from customers where Name = ?")

IF H% = -1 THEN ERRORMES = JDBC_GET_LAST_ERROR$ QUIT ENDIF

 

H% = JDBC_SETPARAM(2,"John’s mother",1)

IF H% = -1 THEN ERRORMES = JDBC_GET_LAST_ERROR$ QUIT ENDIF

 

H% = JDBC_EXEC_PREPARED(2)

IF H% = -1 THEN ERRORMES = JDBC_GET_LAST_ERROR$ QUIT ENDIF

 

See also:

JDBC_PREPARE

JDBC_EXEC_PREPARED