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
546406
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;
    }
1239632
function _query($sql,$inputarr=false)
	{
	GLOBAL $php_errormsg;
		if (isset($php_errormsg)) $php_errormsg = '';
		$this->_error = '';

		if ($inputarr) {
			if (is_array($sql)) {
				$stmtid = $sql[1];
			} else {
				$stmtid = odbc_prepare($this->_connectionID,$sql);

				if ($stmtid == false) {
					$this->_errorMsg = isset($php_errormsg) ? $php_errormsg : '';
					return false;
				}
			}

			if (! odbc_execute($stmtid,$inputarr)) {
				//@odbc_free_result($stmtid);
				if ($this->_haserrorfunctions) {
					$this->_errorMsg = odbc_errormsg();
					$this->_errorCode = odbc_error();
				}
				return false;
			}

		} else if (is_array($sql)) {
			$stmtid = $sql[1];
			if (!odbc_execute($stmtid)) {
				//@odbc_free_result($stmtid);
				if ($this->_haserrorfunctions) {
					$this->_errorMsg = odbc_errormsg();
					$this->_errorCode = odbc_error();
				}
				return false;
			}
		} else
			$stmtid = odbc_exec($this->_connectionID,$sql);

		$this->_lastAffectedRows = 0;
		if ($stmtid) {
			if (@odbc_num_fields($stmtid) == 0) {
				$this->_lastAffectedRows = odbc_num_rows($stmtid);
				$stmtid = true;
			} else {
				$this->_lastAffectedRows = 0;
				odbc_binmode($stmtid,$this->binmode);
				odbc_longreadlen($stmtid,$this->maxblobsize);
			}

			if ($this->_haserrorfunctions) {
				$this->_errorMsg = '';
				$this->_errorCode = 0;
			} else
				$this->_errorMsg = isset($php_errormsg) ? $php_errormsg : '';
		} else {
			if ($this->_haserrorfunctions) {
				$this->_errorMsg = odbc_errormsg();
				$this->_errorCode = odbc_error();
			} else
				$this->_errorMsg = isset($php_errormsg) ? $php_errormsg : '';
		}
		return $stmtid;
	}
1277492
public function execute($sql, array $params=array())
	{
		if ($params) {
			$stmt = $this->prepare($sql);
			if (!$stmt) { return false; }

			$flag = $stmt->execute($params);
			if (!$flag) { return false; }
		} else {
			$stmt = $this->query($sql);
			if (!$stmt) { return false; }
		}

		return $stmt->rowCount();
	}
205805
public function sqlExecute(string $sql, array $params = []): int
    {
        return $this->prepare($sql, $params)->rowCount();
    }
37626
public function execute($input_parameters = null)
    {
        $return = $this->statement->execute($input_parameters);
        if ($this->connection->useDebug) {
            $sql = $this->getExecutedQueryString($input_parameters);
            $this->connection->log($sql);
            $this->connection->setLastExecutedQuery($sql);
            $this->connection->incrementQueryCount();
        }

        return $return;
    }
1322189
public function execute(array $input_parameters = array()) {
		foreach ($input_parameters as $parameter => &$variable) {
			$this->bindParam($parameter, $variable);
		}

		$res = @oci_execute($this->stmt, $this->ociPdoAdapter->getCommitMode());
		$this->checkError($res);

		for ($i = 0; $i < $this->columnCount(); $i++) {
			$cm = $this->getColumnMeta($i);
			if (in_array($cm['native_type'], array('BLOB', 'CLOB'))) {
				array_push($this->_lobColumnsNum, $i);
				array_push($this->_lobColumnsName, $cm['name']);
			}
		}

		if (!empty($this->_lobs)) {
			foreach ($this->_lobs as &$value) {
				if ($value['input']) {
					$res = @$value['lob']->free();
					$this->checkError($res);
				}
				else {
					$value['var'] = $this->lobToStream($value['lob']);
				}
			}
			$this->_lobs = array();
			$this->_lobsCount = 0;

			$res = true;
		}

		if (!is_null($this->_cursor)) {
			$this->closeCursor();
			$this->stmt = $this->_cursor;
			$this->_cursor = null;
			$this->execute();
		}

		return $res;
	}
242129
function Prepare($sql,$cursor=false)
	{
	static $BINDNUM = 0;

		$stmt = oci_parse($this->_connectionID,$sql);

		if (!$stmt) {
			$this->_errorMsg = false;
			$this->_errorCode = false;
			$arr = @oci_error($this->_connectionID);
			if ($arr === false) {
				return false;
			}

			$this->_errorMsg = $arr['message'];
			$this->_errorCode = $arr['code'];
			return false;
		}

		$BINDNUM += 1;

		$sttype = @oci_statement_type($stmt);
		if ($sttype == 'BEGIN' || $sttype == 'DECLARE') {
			return array($sql,$stmt,0,$BINDNUM, ($cursor) ? oci_new_cursor($this->_connectionID) : false);
		}
		return array($sql,$stmt,0,$BINDNUM);
	}
331899
public function execute($sql, $params=array())
    {
        if(!is_array($params))
            $params = array_slice(func_get_args(),1);

        $mysqli = $this->_mysqli();
        $debug = $this->_debug;
        $sql = count($params) ? $this->binder()->bind($sql, $params) : $sql;

        // delegate execution to the filter chain
        return $this->_filter->execute($sql, function($sql) use ($mysqli, $debug) {
            \Pheasant\Database\Mysqli\Connection::$counter++;

            if($debug) {
                $timer = microtime(true);
            }

            $r = $mysqli->query($sql, MYSQLI_STORE_RESULT);

            if($debug) {
                \Pheasant\Database\Mysqli\Connection::$timer += microtime(true)-$timer;
            }

            if ($debug) {
                printf("<pre>Pheasant executed <code>%s</code> on thread #%d in %.2fms, returned %d rows</pre>\n\n",
                    $sql, $mysqli->thread_id, (microtime(true)-$timer)*1000, is_object($r) ? $r->num_rows : 0);
            }

            if ($mysqli->error) {
                if ($mysqli->errno === 1213 || $mysqli->errno === 1479) {
                    throw new DeadlockException($mysqli->error, $mysqli->errno);
                } else {
                    throw new Exception($mysqli->error, $mysqli->errno);
                }
            }

            return new ResultSet($mysqli, $r === true ? false : $r);
        });
    }
1158740
protected function executeUpdate($sql,$bindparams=NULL) {
		$result = $this->db->handle->prepare($sql);
		$result->execute($bindparams);
		if ($result->errorCode() == '00000') {
			return true;
		} 
		$this->logStatementError($result->errorInfo(),$sql);
		return false;
	}
273156
public function execute($input_parameters = null) {
		if (is_array($input_parameters)) $this->boundValues = $input_parameters;
		
		try {
			$mtime = microtime(true);
			$return = parent::execute($input_parameters);
			if (isset($this->logger)) {
				$this->logger->addPreparedExecution($this->queryString, $this->boundValues, (microtime(true) - $mtime));
			}
			
			if (!$return) {
				$err = error_get_last();
				throw new \PDOException($err['message']);
			}
			
			return $return;
		} catch (\PDOException $e) {
			throw new PdoPreparedExecutionException($e, $this->queryString, $this->boundValues);
		}
	}
1288454
public function query(string $sql, array $params = [])
    {
        $prepared = $this->prepare($sql, $params);
        $this->execute($prepared);
        return new ResultSet($prepared['statement']);
    }
162804
public function _execute(array $params = null)
    {
        try {
            if ($params !== null) {
                return $this->_stmt->execute($params);
            } else {
                return $this->_stmt->execute();
            }
        } catch (PDOException $e) {
            // require_once 'Zend/Db/Statement/Exception.php';
            throw new Zend_Db_Statement_Exception($e->getMessage(), (int) $e->getCode(), $e);
        }
    }
391957
private function executeQuery(string $query, array $parameters) : bool
    {
        $statement = $this->pdo->prepare($query);
        $statement->execute($parameters);

        return $statement->rowCount() !== 0;
    }
1267884
public function execute($params = array())
    {
        $this->mergeParams($params);

        $reconnect = $this->db->getOption('reconnect');
        $reconnectRetries = $this->db->getOption('reconnect_retries', 3);
        $reconnectDelayMS = $this->db->getOption('reconnect_delay_ms', 1000);

        while (true) {
            $e = null;
            $errorCode = null;
            $errorInfo = null;
            $result = null;

            $isReconnectError = false;
            try {
                $this->prepare();
                foreach ($this->positionParams as $index => $value) {
                    $this->statement->bindValue($index + 1, $value);
                }

                $result = $this->statement->execute($this->params?:null);
            } catch (\Exception $e) {
            }

            if ($result === false || !$e) {
                $errorCode = $this->statement->errorCode();
                $errorInfo = $this->statement->errorInfo();
            }

            $isReconnectError = Util::checkReconnectError($errorCode, $errorInfo, $e);

            // reconnect
            if ($reconnect && $isReconnectError && $reconnectRetries > 0) {
                $reconnectRetries--;
                $this->statement = null;
                $this->db->close();
                $reconnectDelayMS && usleep($reconnectDelayMS * 1000);
                continue;
            }

            break;
        }

        if ($e) {
            $this->db->logError(sprintf('Statement exception error #%s: %s', $e->getCode(), $e->getMessage()));
            throw $e;
        }

        if ($result === false) {
            $this->db->logError(sprintf('Statement execute error #%s: %s', $errorInfo[0], $errorInfo[2]));
            return false;
        }

        return $this->statement->rowCount();
    }
847246
public function execute()
    {
        if (!$this->sessionSet && $this->platform instanceof MySqlPlatform) {
            $this->connection->exec("SET @@SESSION.sql_mode = '';");
            $this->sessionSet = true;
        }

        // Take a local copy so that we don't modify the original query and cause issues later
        $query = $this->replacePrefix((string) $this->sql);

        if (!($this->sql instanceof \JDatabaseQuery) && ($this->limit > 0 || $this->offset > 0)) {
            // @TODO
            if ($this->offset > 0) {
                $query .= ' LIMIT ' . $this->offset . ', ' . $this->limit;
            } else {
                $query .= ' LIMIT ' . $this->limit;
            }
        }

        $this->prepared = $this->connection->prepare($query);

        // Increment the query counter.
        $this->count++;

        // Reset the error values.
        $this->errorNum = 0;
        $this->errorMsg = '';
        $memoryBefore = null;

        // If debugging is enabled then let's log the query.
        if ($this->debug) {
            // Add the query to the object queue.
            $this->log[] = $query;

            \JLog::add($query, \JLog::DEBUG, 'databasequery');

            $this->timings[] = microtime(true);
        }

        // Execute the query.
        $this->executed = false;
        $previous = null;

        if ($this->prepared instanceof Statement) {
            // Bind the variables:
            if ($this->sql instanceof JDatabaseQueryPreparable) {
                $bounded = $this->sql->getBounded();

                foreach ($bounded as $key => $obj) {
                    $this->prepared->bindParam($key, $obj->value, $obj->dataType, $obj->length, $obj->driverOptions);
                }
            }

            try {
                $this->executed = $this->prepared->execute();
            } catch (\Exception $previous) {
            }
        }

        if ($this->debug) {
            $this->timings[] = microtime(true);

            if (defined('DEBUG_BACKTRACE_IGNORE_ARGS')) {
                $this->callStacks[] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
            } else {
                $this->callStacks[] = debug_backtrace();
            }
        }

        // If an error occurred handle it.
        if (!$this->executed) {
            // Get the error number and message before we execute any more queries.
            $errorNum = (int) $this->connection->errorCode();
            $errorMsg = (string) 'SQL: ' . implode(", ", $this->connection->errorInfo());

            // Get the error number and message from before we tried to reconnect.
            $this->errorNum = $errorNum;
            $this->errorMsg = $errorMsg;

            // Throw the normal query exception.
            \JLog::add(
                \JText::sprintf('JLIB_DATABASE_QUERY_FAILED', $this->errorNum, $this->errorMsg),
                \JLog::ERROR,
                'databasequery'
            );
            throw new RuntimeException($this->errorMsg, $this->errorNum, $previous);
        }

        return $this->prepared;
    }
966858
public function _execute(array $params = null)
    {
        if (!$this->_stmt) {
            return false;
        }

        // if no params were given as an argument to execute(),
        // then default to the _bindParam array
        if ($params === null) {
            $params = $this->_bindParam;
        }
        // send $params as input parameters to the statement
        if ($params) {
            array_unshift($params, str_repeat('s', count($params)));
            $stmtParams = array();
            foreach ($params as $k => &$value) {
                $stmtParams[$k] = &$value;
            }
            call_user_func_array(
                array($this->_stmt, 'bind_param'),
                $stmtParams
                );
        }

        // execute the statement
        $retval = $this->_stmt->execute();
        if ($retval === false) {
            /**
             * @see Zend_Db_Statement_Mysqli_Exception
             */
            // require_once 'Zend/Db/Statement/Mysqli/Exception.php';
            throw new Zend_Db_Statement_Mysqli_Exception("Mysqli statement execute error : " . $this->_stmt->error, $this->_stmt->errno);
        }


        // retain metadata
        if ($this->_meta === null) {
            $this->_meta = $this->_stmt->result_metadata();
            if ($this->_stmt->errno) {
                /**
                 * @see Zend_Db_Statement_Mysqli_Exception
                 */
                // require_once 'Zend/Db/Statement/Mysqli/Exception.php';
                throw new Zend_Db_Statement_Mysqli_Exception("Mysqli statement metadata error: " . $this->_stmt->error, $this->_stmt->errno);
            }
        }

        // statements that have no result set do not return metadata
        if ($this->_meta !== false) {

            // get the column names that will result
            $this->_keys = array();
            foreach ($this->_meta->fetch_fields() as $col) {
                $this->_keys[] = $this->_adapter->foldCase($col->name);
            }

            // set up a binding space for result variables
            $this->_values = array_fill(0, count($this->_keys), null);

            // set up references to the result binding space.
            // just passing $this->_values in the call_user_func_array()
            // below won't work, you need references.
            $refs = array();
            foreach ($this->_values as $i => &$f) {
                $refs[$i] = &$f;
            }

            $this->_stmt->store_result();
            // bind to the result variables
            call_user_func_array(
                array($this->_stmt, 'bind_result'),
                $this->_values
            );
        }
        return $retval;
    }
376431
public function execute(string $query, array $parameters = []): int
    {
        return $this->statement($query, $parameters)->rowCount();
    }