db2_bind_param

PECL ibm_db2 >= 1.0.0
db2_bind_param - Binds a PHP variable to an SQL statement parameter
Manual
Code Examples

db2_bind_param(
     resource$stmt,
     int$parameter_number,
     string$variable_name,
     [int$parameter_type],
     [int$data_type = 0],
     [int$precision = -1],
     [int$scale = 0]
): bool

Binds a PHP variable to an SQL statement parameter in a statement resource returned by db2_prepare. This function gives you more control over the parameter type, data type, precision, and scale for the parameter than simply passing the variable as part of the optional input array to db2_execute.

Parameters

stmt

A prepared statement returned from db2_prepare.

parameter_number

Specifies the 1-indexed position of the parameter in the prepared statement.

variable_name

A string specifying the name of the PHP variable to bind to the parameter specified by parameter_number.

parameter_type

A constant specifying whether the PHP variable should be bound to the SQL parameter as an input parameter (DB2_PARAM_IN), an output parameter (DB2_PARAM_OUT), or as a parameter that accepts input and returns output (DB2_PARAM_INOUT). To avoid memory overhead, you can also specify DB2_PARAM_FILE to bind the PHP variable to the name of a file that contains large object (BLOB, CLOB, or DBCLOB) data.

data_type

A constant specifying the SQL data type that the PHP variable should be bound as: one of DB2_BINARY, DB2_CHAR, DB2_DOUBLE, or DB2_LONG .

precision

Specifies the precision with which the variable should be bound to the database. This parameter can also be used for retrieving XML output values from stored procedures. A non-negative value specifies the maximum size of the XML data that will be retrieved from the database. If this parameter is not used, a default of 1MB will be assumed for retrieving the XML output value from the stored procedure.

scale

Specifies the scale with which the variable should be bound to the database.

Return Values

Returns true on success or false on failure.

Related Functions

Example of db2_bind_param

Show all examples for db2_bind_param

PHP Version: