/** * Binds a parameter to the specified variable name. * * @param mixed $parameter Name the parameter, either integer or string. * @param mixed $variable Reference to PHP variable containing the value. * @param mixed $type OPTIONAL Datatype of SQL parameter. * @param mixed $length OPTIONAL Length of SQL parameter. * @param mixed $options OPTIONAL Other options. * @return bool */ public function bindParam($parameter, &$variable, $type = null, $length = null, $options = null) { if (!is_int($parameter) && !is_string($parameter)) { throw new Exception('Invalid bind-variable position'); } $position = null; if (($intval = (int) $parameter) > 0 && $this->_adapter->supportsParameters('positional')) { if ($intval >= 1 || $intval <= count($this->_sqlParam)) { $position = $intval; } } else { if ($this->_adapter->supportsParameters('named')) { if ($parameter[0] != ':') { $parameter = ':' . $parameter; } if (in_array($parameter, $this->_sqlParam) !== false) { $position = $parameter; } } } if ($position === null) { throw new Exception("Invalid bind-variable position '{$parameter}'"); } // Finally we are assured that $position is valid $this->_bindParam[$position] =& $variable; return $this->_bindParam($position, $variable, $type, $length, $options); }