oci_bind_by_name()
oci_bind_by_name - Binds a PHP variable to an Oracle placeholder
Syntax
bool oci_bind_by_name (
resource $statement,
string $bv_name,
mixed &$variable,
int $maxlength,
int $type)
Arguments
- statement - A valid OCI8 statement identifer.
- bv_name - The colon-prefixed bind variable placeholder used in the statement. The colon is optional in bv_name. Oracle does not use question marks for placeholders.
- variable - The PHP variable to be associated with bv_name
- maxlength - Sets the maximum length for the data. If you set it to -1, this function will use the current length of variable to set the maximum length. In this case the variable must exist and contain data when oci_bind_by_name() is called.
- type - The datatype that Oracle will treat the data as. The default type used is SQLT_CHR. Oracle will convert the data between this type and the database column (or PL/SQL variable type), when possible. If you need to bind an abstract datatype (LOB/ROWID/BFILE) you need to allocate it first using the oci_new_descriptor() function. The length is not used for abstract datatypes and should be set to -1. Possible values for type are: SQLT_BFILEE or OCI_B_BFILE - for BFILEs; SQLT_CFILEE or OCI_B_CFILEE - for CFILEs; SQLT_CLOB or OCI_B_CLOB - for CLOBs; SQLT_BLOB or OCI_B_BLOB - for BLOBs; SQLT_RDD or OCI_B_ROWID - for ROWIDs; SQLT_NTY or OCI_B_NTY - for named datatypes; SQLT_INT or OCI_B_INT - for integers; SQLT_CHR - for VARCHARs; SQLT_BIN or OCI_B_BIN - for RAW columns; SQLT_LNG - for LONG columns; SQLT_LBI - for LONG RAW columns; SQLT_RSET - for cursors created with oci_new_cursor().
Description
Binds a PHP variable variable to the Oracle bind variable placeholder bv_name. Binding is important for Oracle database performance and also as a way to avoid SQL Injection security issues.
Version
PHP 5, PECL OCI8 >= 1.1.0
Return value
Returns TRUE on success or FALSE on failure.