setParameters()

variable.SetParameters(value [, value...])

This method is used with a variable of the PREPARED data type. The variable must first be initialized using the Prepare() method. The SetParameters() method is used if the prepared statement contains any placeholders - it supplies values to substitute these placeholders.

Usage

This method accepts a number of arguments, their number, order and data types depending on the placeholders. The values are bound by reference, so any changes in the bound values will be reflected in the prepared statement.

You can call the SetParameters() method for the PREPARED variable, if this variable is then used independently of any cursor. If you use this variable in the Declare() method to associate the prepared statement with a cursor, you need to execute the SetParameters() method for the CURSOR variable declared by this method and not for the PREPARED variable.

An example method call:

# Using it for the PREPARED variable

DEFINE prep_v PREPARED

 

CALL prep_v.Prepare("SELECT * FROM customers WHERE cust_id>?")

CALL prep_v.SetParameters(100)

...

# Using it for a CURSOR variable

DEFINE prep_v PREPARED,

       cur_v  CURSOR

CALL prep_v.Prepare("SELECT * FROM customers WHERE cust_id>?")

CALL cur_v.Declare(prep_v)

CALL cur_v.SetParameters(100)