Пример #1
0
 /**
  * Execute a prepared query statement helper method.
  *
  * @param mixed $result_class string which specifies which result class to use
  * @param mixed $result_wrap_class string which specifies which class to wrap results in
  * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
  * @access private
  */
 function &_execute($result_class = true, $result_wrap_class = false)
 {
     if (is_null($this->statement)) {
         $result =& parent::_execute($result_class, $result_wrap_class);
         return $result;
     }
     $this->db->last_query = $this->query;
     $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'pre', 'parameters' => $this->values));
     if ($this->db->getOption('disable_query')) {
         $result = $this->is_manip ? 0 : null;
         return $result;
     }
     $connection = $this->db->getConnection();
     if (PEAR::isError($connection)) {
         return $connection;
     }
     if (!is_object($this->statement)) {
         $query = 'EXECUTE ' . $this->statement;
     }
     if (!empty($this->positions)) {
         $parameters = array(0 => $this->statement, 1 => '');
         $lobs = array();
         $i = 0;
         foreach ($this->positions as $parameter) {
             if (!array_key_exists($parameter, $this->values)) {
                 return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'Unable to bind to missing placeholder: ' . $parameter, __FUNCTION__);
             }
             $value = $this->values[$parameter];
             $type = array_key_exists($parameter, $this->types) ? $this->types[$parameter] : null;
             if (!is_object($this->statement)) {
                 if (is_resource($value) || $type == 'clob' || $type == 'blob') {
                     if (!is_resource($value) && preg_match('/^(\\w+:\\/\\/)(.*)$/', $value, $match)) {
                         if ($match[1] == 'file://') {
                             $value = $match[2];
                         }
                         $value = @fopen($value, 'r');
                         $close = true;
                     }
                     if (is_resource($value)) {
                         $data = '';
                         while (!@feof($value)) {
                             $data .= @fread($value, $this->db->options['lob_buffer_length']);
                         }
                         if ($close) {
                             @fclose($value);
                         }
                         $value = $data;
                     }
                 }
                 $quoted = $this->db->quote($value, $type);
                 if (PEAR::isError($quoted)) {
                     return $quoted;
                 }
                 $param_query = 'SET @' . $parameter . ' = ' . $quoted;
                 $result = $this->db->_doQuery($param_query, true, $connection);
                 if (PEAR::isError($result)) {
                     return $result;
                 }
             } else {
                 if (is_resource($value) || $type == 'clob' || $type == 'blob') {
                     $parameters[] = null;
                     $parameters[1] .= 'b';
                     $lobs[$i] = $parameter;
                 } else {
                     $parameters[] = $this->db->quote($value, $type, false);
                     $parameters[1] .= $this->db->datatype->mapPrepareDatatype($type);
                 }
                 ++$i;
             }
         }
         if (!is_object($this->statement)) {
             $query .= ' USING @' . implode(', @', array_values($this->positions));
         } else {
             $result = @call_user_func_array('mysqli_stmt_bind_param', $parameters);
             if ($result === false) {
                 $err =& $this->db->raiseError(null, null, null, 'Unable to bind parameters', __FUNCTION__);
                 return $err;
             }
             foreach ($lobs as $i => $parameter) {
                 $value = $this->values[$parameter];
                 $close = false;
                 if (!is_resource($value)) {
                     $close = true;
                     if (preg_match('/^(\\w+:\\/\\/)(.*)$/', $value, $match)) {
                         if ($match[1] == 'file://') {
                             $value = $match[2];
                         }
                         $value = @fopen($value, 'r');
                     } else {
                         $fp = @tmpfile();
                         @fwrite($fp, $value);
                         @rewind($fp);
                         $value = $fp;
                     }
                 }
                 while (!@feof($value)) {
                     $data = @fread($value, $this->db->options['lob_buffer_length']);
                     @mysqli_stmt_send_long_data($this->statement, $i, $data);
                 }
                 if ($close) {
                     @fclose($value);
                 }
             }
         }
     }
     if (!is_object($this->statement)) {
         $result = $this->db->_doQuery($query, $this->is_manip, $connection);
         if (PEAR::isError($result)) {
             return $result;
         }
         if ($this->is_manip) {
             $affected_rows = $this->db->_affectedRows($connection, $result);
             return $affected_rows;
         }
         $result =& $this->db->_wrapResult($result, $this->result_types, $result_class, $result_wrap_class, $this->limit, $this->offset);
     } else {
         if (!@mysqli_stmt_execute($this->statement)) {
             $err =& $this->db->raiseError(null, null, null, 'Unable to execute statement', __FUNCTION__);
             return $err;
         }
         if ($this->is_manip) {
             $affected_rows = @mysqli_stmt_affected_rows($this->statement);
             return $affected_rows;
         }
         if ($this->db->options['result_buffering']) {
             @mysqli_stmt_store_result($this->statement);
         }
         $result =& $this->db->_wrapResult($this->statement, $this->result_types, $result_class, $result_wrap_class, $this->limit, $this->offset);
     }
     $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'post', 'result' => $result));
     return $result;
 }
Пример #2
0
 /**
  * Execute a prepared query statement helper method.
  *
  * @param mixed $result_class string which specifies which result class to use
  * @param mixed $result_wrap_class string which specifies which class to wrap results in
  * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
  * @access private
  */
 function &_execute($result_class = true, $result_wrap_class = false)
 {
     if (is_null($this->statement)) {
         $result =& parent::_execute($result_class, $result_wrap_class);
         return $result;
     }
     $this->db->last_query = $this->query;
     $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'pre', 'parameters' => $this->values));
     if ($this->db->getOption('disable_query')) {
         $result = $this->is_manip ? 0 : null;
         return $result;
     }
     $connection = $this->db->getConnection();
     if (PEAR::isError($connection)) {
         return $connection;
     }
     $query = 'EXECUTE ' . $this->statement;
     if (!empty($this->positions)) {
         $parameters = array();
         foreach ($this->positions as $parameter) {
             if (!array_key_exists($parameter, $this->values)) {
                 return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'Unable to bind to missing placeholder: ' . $parameter, __FUNCTION__);
             }
             $value = $this->values[$parameter];
             $type = array_key_exists($parameter, $this->types) ? $this->types[$parameter] : null;
             if (is_resource($value) || $type == 'clob' || $type == 'blob') {
                 if (!is_resource($value) && preg_match('/^(\\w+:\\/\\/)(.*)$/', $value, $match)) {
                     if ($match[1] == 'file://') {
                         $value = $match[2];
                     }
                     $value = @fopen($value, 'r');
                     $close = true;
                 }
                 if (is_resource($value)) {
                     $data = '';
                     while (!@feof($value)) {
                         $data .= @fread($value, $this->db->options['lob_buffer_length']);
                     }
                     if ($close) {
                         @fclose($value);
                     }
                     $value = $data;
                 }
             }
             $quoted = $this->db->quote($value, $type);
             if (PEAR::isError($quoted)) {
                 return $quoted;
             }
             $param_query = 'SET @' . $parameter . ' = ' . $quoted;
             $result = $this->db->_doQuery($param_query, true, $connection);
             if (PEAR::isError($result)) {
                 return $result;
             }
         }
         $query .= ' USING @' . implode(', @', array_values($this->positions));
     }
     $result = $this->db->_doQuery($query, $this->is_manip, $connection);
     if (PEAR::isError($result)) {
         return $result;
     }
     if ($this->is_manip) {
         $affected_rows = $this->db->_affectedRows($connection, $result);
         return $affected_rows;
     }
     $result =& $this->db->_wrapResult($result, $this->result_types, $result_class, $result_wrap_class, $this->limit, $this->offset);
     $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'post', 'result' => $result));
     return $result;
 }
Пример #3
0
 /**
  * Execute a prepared query statement helper method.
  *
  * @param mixed $result_class string which specifies which result class to use
  * @param mixed $result_wrap_class string which specifies which class to wrap results in
  *
  * @return mixed MDB2_Result or integer (affected rows) on success,
  *               a MDB2 error on failure
  * @access private
  */
 function _execute($result_class = true, $result_wrap_class = false)
 {
     if (is_null($this->statement)) {
         $result =& parent::_execute($result_class, $result_wrap_class);
         return $result;
     }
     $this->db->last_query = $this->query;
     $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'pre', 'parameters' => $this->values));
     if ($this->db->getOption('disable_query')) {
         $result = $this->is_manip ? 0 : null;
         return $result;
     }
     $connection = $this->db->getConnection();
     if (PEAR::isError($connection)) {
         return $connection;
     }
     $result = $this->statement->execute();
     if ($result == false) {
         $err = $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'cant execute statement', __FUNCTION__);
     }
     if ($this->is_manip) {
         $affected_rows = $this->db->_affectedRows($connection, $result);
         return $affected_rows;
     }
     $result =& $this->db->_wrapResult($result, $this->result_types, $result_class, $result_wrap_class, $this->limit, $this->offset);
     $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'post', 'result' => $result));
     return $result;
 }
Пример #4
0
 /**
  * Execute a prepared query statement helper method.
  *
  * @param mixed $result_class string which specifies which result class to use
  * @param mixed $result_wrap_class string which specifies which class to wrap results in
  *
  * @return mixed MDB2_Result or integer (affected rows) on success,
  *               a MDB2 error on failure
  * @access private
  */
 function _execute($result_class = true, $result_wrap_class = false)
 {
     if (null === $this->statement) {
         return parent::_execute($result_class, $result_wrap_class);
     }
     $this->db->last_query = $this->query;
     $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'pre', 'parameters' => $this->values));
     if ($this->db->getOption('disable_query')) {
         $result = $this->is_manip ? 0 : null;
         return $result;
     }
     $connection = $this->db->getConnection();
     if (PEAR::isError($connection)) {
         return $connection;
     }
     $query = false;
     $parameters = array();
     // todo: disabled until pg_execute() bytea issues are cleared up
     if (true || !function_exists('pg_execute')) {
         $query = 'EXECUTE ' . $this->statement;
     }
     if (!empty($this->positions)) {
         foreach ($this->positions as $parameter) {
             if (!array_key_exists($parameter, $this->values)) {
                 return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'Unable to bind to missing placeholder: ' . $parameter, __FUNCTION__);
             }
             $value = $this->values[$parameter];
             $type = array_key_exists($parameter, $this->types) ? $this->types[$parameter] : null;
             if (is_resource($value) || $type == 'clob' || $type == 'blob' || $this->db->options['lob_allow_url_include']) {
                 if (!is_resource($value) && preg_match('/^(\\w+:\\/\\/)(.*)$/', $value, $match)) {
                     if ($match[1] == 'file://') {
                         $value = $match[2];
                     }
                     $value = @fopen($value, 'r');
                     $close = true;
                 }
                 if (is_resource($value)) {
                     $data = '';
                     while (!@feof($value)) {
                         $data .= @fread($value, $this->db->options['lob_buffer_length']);
                     }
                     if ($close) {
                         @fclose($value);
                     }
                     $value = $data;
                 }
             }
             $quoted = $this->db->quote($value, $type, $query);
             if (PEAR::isError($quoted)) {
                 return $quoted;
             }
             $parameters[] = $quoted;
         }
         if ($query) {
             $query .= ' (' . implode(', ', $parameters) . ')';
         }
     }
     if (!$query) {
         $result = @pg_execute($connection, $this->statement, $parameters);
         if (!$result) {
             $err = $this->db->raiseError(null, null, null, 'Unable to execute statement', __FUNCTION__);
             return $err;
         }
     } else {
         $result = $this->db->_doQuery($query, $this->is_manip, $connection);
         if (PEAR::isError($result)) {
             return $result;
         }
     }
     if ($this->is_manip) {
         $affected_rows = $this->db->_affectedRows($connection, $result);
         return $affected_rows;
     }
     $result = $this->db->_wrapResult($result, $this->result_types, $result_class, $result_wrap_class, $this->limit, $this->offset);
     $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'post', 'result' => $result));
     return $result;
 }
Пример #5
0
 /**
  * Execute a prepared query statement helper method.
  *
  * @param mixed $result_class string which specifies which result class to use
  * @param mixed $result_wrap_class string which specifies which class to wrap results in
  * @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
  * @access private
  */
 function &_execute($result_class = true, $result_wrap_class = false)
 {
     if (is_null($this->statement)) {
         $result =& parent::_execute($result_class, $result_wrap_class);
         return $result;
     }
     $this->db->last_query = $this->query;
     $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'pre', 'parameters' => $this->values));
     if ($this->db->getOption('disable_query')) {
         $result = $this->is_manip ? 0 : null;
         return $result;
     }
     $connection = $this->db->getConnection();
     if (PEAR::isError($connection)) {
         return $connection;
     }
     $result = MDB2_OK;
     $lobs = $quoted_values = array();
     $i = 0;
     foreach ($this->positions as $parameter) {
         if (!array_key_exists($parameter, $this->values)) {
             return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'Unable to bind to missing placeholder: ' . $parameter, __FUNCTION__);
         }
         $value = $this->values[$parameter];
         $type = array_key_exists($parameter, $this->types) ? $this->types[$parameter] : null;
         if ($type == 'clob' || $type == 'blob') {
             $lobs[$i]['file'] = false;
             if (is_resource($value)) {
                 $fp = $value;
                 $value = '';
                 while (!feof($fp)) {
                     $value .= fread($fp, 8192);
                 }
             } elseif (preg_match('/^(\\w+:\\/\\/)(.*)$/', $value, $match)) {
                 $lobs[$i]['file'] = true;
                 if ($match[1] == 'file://') {
                     $value = $match[2];
                 }
             }
             $lobs[$i]['value'] = $value;
             $lobs[$i]['descriptor'] = @OCINewDescriptor($connection, OCI_D_LOB);
             if (!is_object($lobs[$i]['descriptor'])) {
                 $result = $this->db->raiseError(null, null, null, 'Unable to create descriptor for LOB in parameter: ' . $parameter, __FUNCTION__);
                 break;
             }
             $lob_type = $type == 'blob' ? OCI_B_BLOB : OCI_B_CLOB;
             if (!@OCIBindByName($this->statement, ':' . $parameter, $lobs[$i]['descriptor'], -1, $lob_type)) {
                 $result = $this->db->raiseError($this->statement, null, null, 'could not bind LOB parameter', __FUNCTION__);
                 break;
             }
         } else {
             $quoted_values[$i] = $this->db->quote($value, $type, false);
             if (PEAR::isError($quoted_values[$i])) {
                 return $quoted_values[$i];
             }
             if (!@OCIBindByName($this->statement, ':' . $parameter, $quoted_values[$i])) {
                 $result = $this->db->raiseError($this->statement, null, null, 'could not bind non LOB parameter', __FUNCTION__);
                 break;
             }
         }
         ++$i;
     }
     $lob_keys = array_keys($lobs);
     if (!PEAR::isError($result)) {
         $mode = !empty($lobs) || $this->db->in_transaction ? OCI_DEFAULT : OCI_COMMIT_ON_SUCCESS;
         if (!@OCIExecute($this->statement, $mode)) {
             $err =& $this->db->raiseError($this->statement, null, null, 'could not execute statement', __FUNCTION__);
             return $err;
         }
         if (!empty($lobs)) {
             foreach ($lob_keys as $i) {
                 if (!is_null($lobs[$i]['value']) && $lobs[$i]['value'] !== '') {
                     if ($lobs[$i]['file']) {
                         $result = $lobs[$i]['descriptor']->savefile($lobs[$i]['value']);
                     } else {
                         $result = $lobs[$i]['descriptor']->save($lobs[$i]['value']);
                     }
                     if (!$result) {
                         $result = $this->db->raiseError(null, null, null, 'Unable to save descriptor contents', __FUNCTION__);
                         break;
                     }
                 }
             }
             if (!PEAR::isError($result)) {
                 if (!$this->db->in_transaction) {
                     if (!@OCICommit($connection)) {
                         $result = $this->db->raiseError(null, null, null, 'Unable to commit transaction', __FUNCTION__);
                     }
                 } else {
                     ++$this->db->uncommitedqueries;
                 }
             }
         }
     }
     $lob_keys = array_keys($lobs);
     foreach ($lob_keys as $i) {
         $lobs[$i]['descriptor']->free();
     }
     if (PEAR::isError($result)) {
         return $result;
     }
     if ($this->is_manip) {
         $affected_rows = $this->db->_affectedRows($connection, $this->statement);
         return $affected_rows;
     }
     $result =& $this->db->_wrapResult($this->statement, $this->result_types, $result_class, $result_wrap_class, $this->limit, $this->offset);
     $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'post', 'result' => $result));
     return $result;
 }
Пример #6
0
 /**
  * Execute a prepared query statement helper method.
  *
  * @param mixed $result_class string which specifies which result class to use
  * @param mixed $result_wrap_class string which specifies which class to wrap results in
  *
  * @return mixed MDB2_Result or integer (affected rows) on success,
  *               a MDB2 error on failure
  * @access private
  */
 function _execute($result_class = true, $result_wrap_class = true)
 {
     if (null === $this->statement) {
         $result = parent::_execute($result_class, $result_wrap_class);
         return $result;
     }
     $this->db->last_query = $this->query;
     $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'pre', 'parameters' => $this->values));
     if ($this->db->getOption('disable_query')) {
         $result = $this->is_manip ? 0 : null;
         return $result;
     }
     $connection = $this->db->getConnection();
     if (MDB2::isError($connection)) {
         return $connection;
     }
     $parameters = array(0 => $this->statement);
     foreach ($this->positions as $parameter) {
         if (!array_key_exists($parameter, $this->values)) {
             return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'Unable to bind to missing placeholder: ' . $parameter, __FUNCTION__);
         }
         $value = $this->values[$parameter];
         $type = !empty($this->types[$parameter]) ? $this->types[$parameter] : null;
         $quoted = $this->db->quote($value, $type, false);
         if (MDB2::isError($quoted)) {
             return $quoted;
         }
         $parameters[] = $quoted;
     }
     $result = @call_user_func_array('ibase_execute', $parameters);
     if (false === $result) {
         $err = $this->db->raiseError(null, null, null, 'Could not execute statement', __FUNCTION__);
         return $err;
     }
     if ($this->is_manip) {
         $affected_rows = $this->db->_affectedRows($connection);
         return $affected_rows;
     }
     $result = $this->db->_wrapResult($result, $this->result_types, $result_class, $result_wrap_class, $this->limit, $this->offset);
     $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'post', 'result' => $result));
     return $result;
 }
Пример #7
0
 /**
  * Execute a prepared query statement helper method.
  *
  * @param mixed $result_class string which specifies which result class to use
  * @param mixed $result_wrap_class string which specifies which class to wrap results in
  *
  * @return mixed MDB2_Result or integer (affected rows) on success,
  *               a MDB2 error on failure
  * @access private
  */
 function _execute($result_class = true, $result_wrap_class = false)
 {
     if (null === $this->statement) {
         return parent::_execute($result_class, $result_wrap_class);
     }
     $this->db->last_query = $this->query;
     $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'pre', 'parameters' => $this->values));
     if ($this->db->getOption('disable_query')) {
         $result = $this->is_manip ? 0 : null;
         return $result;
     }
     $connection = $this->db->getConnection();
     if (PEAR::isError($connection)) {
         return $connection;
     }
     $result = MDB2_OK;
     $lobs = $quoted_values = array();
     $i = 0;
     foreach ($this->positions as $parameter) {
         if (!array_key_exists($parameter, $this->values)) {
             return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'Unable to bind to missing placeholder: ' . $parameter, __FUNCTION__);
         }
         $type = array_key_exists($parameter, $this->types) ? $this->types[$parameter] : null;
         if ($type == 'clob' || $type == 'blob') {
             $lobs[$i]['file'] = false;
             if (is_resource($this->values[$parameter])) {
                 $fp = $this->values[$parameter];
                 $this->values[$parameter] = '';
                 while (!feof($fp)) {
                     $this->values[$parameter] .= fread($fp, 8192);
                 }
             } elseif (is_a($this->values[$parameter], 'OCI-Lob')) {
                 //do nothing
             } elseif ($this->db->getOption('lob_allow_url_include') && preg_match('/^(\\w+:\\/\\/)(.*)$/', $this->values[$parameter], $match)) {
                 $lobs[$i]['file'] = true;
                 if ($match[1] == 'file://') {
                     $this->values[$parameter] = $match[2];
                 }
             }
             $lobs[$i]['value'] = $this->values[$parameter];
             $lobs[$i]['descriptor'] =& $this->values[$parameter];
             // Test to see if descriptor has already been created for this
             // variable (i.e. if it has been bound more than once):
             if (!is_a($this->values[$parameter], 'OCI-Lob')) {
                 $this->values[$parameter] = @OCINewDescriptor($connection, OCI_D_LOB);
                 if (false === $this->values[$parameter]) {
                     $result = $this->db->raiseError(null, null, null, 'Unable to create descriptor for LOB in parameter: ' . $parameter, __FUNCTION__);
                     break;
                 }
             }
             $lob_type = $type == 'blob' ? OCI_B_BLOB : OCI_B_CLOB;
             if (!@OCIBindByName($this->statement, ':' . $parameter, $lobs[$i]['descriptor'], -1, $lob_type)) {
                 $result = $this->db->raiseError($this->statement, null, null, 'could not bind LOB parameter', __FUNCTION__);
                 break;
             }
         } else {
             if ($type == OCI_B_BFILE) {
                 // Test to see if descriptor has already been created for this
                 // variable (i.e. if it has been bound more than once):
                 if (!is_a($this->values[$parameter], "OCI-Lob")) {
                     $this->values[$parameter] = @OCINewDescriptor($connection, OCI_D_FILE);
                     if (false === $this->values[$parameter]) {
                         $result = $this->db->raiseError(null, null, null, 'Unable to create descriptor for BFILE in parameter: ' . $parameter, __FUNCTION__);
                         break;
                     }
                 }
                 if (!@OCIBindByName($this->statement, ':' . $parameter, $this->values[$parameter], -1, $type)) {
                     $result = $this->db->raiseError($this->statement, null, null, 'Could not bind BFILE parameter', __FUNCTION__);
                     break;
                 }
             } else {
                 if ($type == OCI_B_ROWID) {
                     // Test to see if descriptor has already been created for this
                     // variable (i.e. if it has been bound more than once):
                     if (!is_a($this->values[$parameter], "OCI-Lob")) {
                         $this->values[$parameter] = @OCINewDescriptor($connection, OCI_D_ROWID);
                         if (false === $this->values[$parameter]) {
                             $result = $this->db->raiseError(null, null, null, 'Unable to create descriptor for ROWID in parameter: ' . $parameter, __FUNCTION__);
                             break;
                         }
                     }
                     if (!@OCIBindByName($this->statement, ':' . $parameter, $this->values[$parameter], -1, $type)) {
                         $result = $this->db->raiseError($this->statement, null, null, 'Could not bind ROWID parameter', __FUNCTION__);
                         break;
                     }
                 } else {
                     if ($type == OCI_B_CURSOR) {
                         // Test to see if cursor has already been allocated for this
                         // variable (i.e. if it has been bound more than once):
                         if (!is_resource($this->values[$parameter]) || !get_resource_type($this->values[$parameter]) == "oci8 statement") {
                             $this->values[$parameter] = @OCINewCursor($connection);
                             if (false === $this->values[$parameter]) {
                                 $result = $this->db->raiseError(null, null, null, 'Unable to allocate cursor for parameter: ' . $parameter, __FUNCTION__);
                                 break;
                             }
                         }
                         if (!@OCIBindByName($this->statement, ':' . $parameter, $this->values[$parameter], -1, $type)) {
                             $result = $this->db->raiseError($this->statement, null, null, 'Could not bind CURSOR parameter', __FUNCTION__);
                             break;
                         }
                     } else {
                         $maxlength = array_key_exists($parameter, $this->type_maxlengths) ? $this->type_maxlengths[$parameter] : -1;
                         $this->values[$parameter] = $this->db->quote($this->values[$parameter], $type, false);
                         $quoted_values[$i] =& $this->values[$parameter];
                         if (PEAR::isError($quoted_values[$i])) {
                             return $quoted_values[$i];
                         }
                         if (!@OCIBindByName($this->statement, ':' . $parameter, $quoted_values[$i], $maxlength)) {
                             $result = $this->db->raiseError($this->statement, null, null, 'could not bind non-abstract parameter', __FUNCTION__);
                             break;
                         }
                     }
                 }
             }
         }
         ++$i;
     }
     $lob_keys = array_keys($lobs);
     if (!PEAR::isError($result)) {
         $mode = !empty($lobs) || $this->db->in_transaction ? OCI_DEFAULT : OCI_COMMIT_ON_SUCCESS;
         if (!@OCIExecute($this->statement, $mode)) {
             $err = $this->db->raiseError($this->statement, null, null, 'could not execute statement', __FUNCTION__);
             return $err;
         }
         if (!empty($lobs)) {
             foreach ($lob_keys as $i) {
                 if (null !== $lobs[$i]['value'] && $lobs[$i]['value'] !== '') {
                     if (is_object($lobs[$i]['value'])) {
                         // Probably a NULL LOB
                         // @see http://bugs.php.net/bug.php?id=27485
                         continue;
                     }
                     if ($lobs[$i]['file']) {
                         $result = $lobs[$i]['descriptor']->savefile($lobs[$i]['value']);
                     } else {
                         $result = $lobs[$i]['descriptor']->save($lobs[$i]['value']);
                     }
                     if (!$result) {
                         $result = $this->db->raiseError(null, null, null, 'Unable to save descriptor contents', __FUNCTION__);
                         break;
                     }
                 }
             }
             if (!PEAR::isError($result)) {
                 if (!$this->db->in_transaction) {
                     if (!@OCICommit($connection)) {
                         $result = $this->db->raiseError(null, null, null, 'Unable to commit transaction', __FUNCTION__);
                     }
                 } else {
                     ++$this->db->uncommitedqueries;
                 }
             }
         }
     }
     if (PEAR::isError($result)) {
         return $result;
     }
     if ($this->is_manip) {
         $affected_rows = $this->db->_affectedRows($connection, $this->statement);
         return $affected_rows;
     }
     $result = $this->db->_wrapResult($this->statement, $this->result_types, $result_class, $result_wrap_class, $this->limit, $this->offset);
     $this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'post', 'result' => $result));
     return $result;
 }