/** * Executes a prepared statement * * @param array $inputParams An array of values with as many elements as * there are bound parameters in the SQL statement being executed. * @throws Oci8Exception * @return bool TRUE on success or FALSE on failure */ public function execute($inputParams = null) { $mode = OCI_COMMIT_ON_SUCCESS; if ($this->_pdoOci8->inTransaction()) { $mode = OCI_DEFAULT; } // Set up bound parameters, if passed in if (is_array($inputParams)) { foreach ($inputParams as $key => $value) { $this->bindParam($key, $inputParams[$key]); } } $result = @oci_execute($this->_sth, $mode); if ($result != true) { $e = oci_error($this->_sth); $message = ''; $message = $message . 'Error Code : ' . $e['code'] . PHP_EOL; $message = $message . 'Error Message : ' . $e['message'] . PHP_EOL; $message = $message . 'Position : ' . $e['offset'] . PHP_EOL; $message = $message . 'Statement : ' . $e['sqltext'] . PHP_EOL; $message = $message . 'Bindings : [' . implode(',', (array) $inputParams) . ']' . PHP_EOL; throw new Oci8Exception($message, $e['code']); } return $result; }
/** * Executes a prepared statement. * * @param array $inputParams An array of values with as many elements as * there are bound parameters in the SQL statement being executed. * @throws Oci8Exception * @return bool TRUE on success or FALSE on failure */ public function execute($inputParams = null) { $mode = OCI_COMMIT_ON_SUCCESS; if ($this->connection->inTransaction() || count($this->blobObjects) > 0) { $mode = OCI_DEFAULT; } // Set up bound parameters, if passed in. if (is_array($inputParams)) { foreach ($inputParams as $key => $value) { $this->bindings[] = $value; $this->bindParam($key, $inputParams[$key]); } } $result = @oci_execute($this->sth, $mode); // Save blob objects if set. if ($result && count($this->blobObjects) > 0) { foreach ($this->blobObjects as $param => $blob) { /** @var \OCI_Lob $blob */ $blob->save($this->blobBindings[$param]); } } if (!$this->connection->inTransaction() && count($this->blobObjects) > 0) { $this->connection->commit(); } if ($result != true) { $e = oci_error($this->sth); $message = ''; $message = $message . 'Error Code : ' . $e['code'] . PHP_EOL; $message = $message . 'Error Message : ' . $e['message'] . PHP_EOL; $message = $message . 'Position : ' . $e['offset'] . PHP_EOL; $message = $message . 'Statement : ' . $e['sqltext'] . PHP_EOL; $message = $message . 'Bindings : [' . $this->displayBindings() . ']' . PHP_EOL; throw new Oci8Exception($message, $e['code']); } return $result; }