dbh = $dbh; } private function _genericBind($function) { // Function is called with varying number of arguments $args = array_slice(func_get_args(), 1); // Bind the first placeholder by the appropriate method call_user_func_array(array(parent, $function), $args); if (true === $this->dbh->options['singleTokenMultiParams']) { // First argument is the placeholder $placeholder = array_shift($args); // Recover placeholder information from the prepared statement $tokens = $this->dbh->tokens[$this->queryString]; $count = $tokens[$placeholder]; // Only interested in multiple placeholders with the same name if ($count > 1) { // Bind the value to each of the extra uniquely-named placeholders for($loop = 1; $loop < $count; $loop++) { $uniqname = $placeholder . '_' . $loop; call_user_func_array(array(parent, $function), array_merge(array($uniqname), $args)); } } } } // Wrapper to call the generic binding function public function bindValue($placeholder, $value, $type=null) { $this->_genericBind(__FUNCTION__, $placeholder, $value, $type); } // Wrapper to call the generic binding function public function bindParam($placeholder, $value, $type=null, $length=null, $options=null) { $this->_genericBind(__FUNCTION__, $placeholder, $value, $type, $length, $options); } } // Use the driver options array to specify new behaviour $dbh = SprocketPDO_Factory::getInstance(PDO_DSN, PDO_USER, PDO_PASSWORD, array( 'singleTokenMultiParams' => true, )); ?>