Executes a prepared statement.

@return object
767544
public function exec()
    {
        $result = $this->statement->execute();

        if ($result) {
            return $this;
        } else {
            throw new Exception($this->statement->errorInfo()[2]);
        }
    }
971772
protected function execute()
    {
        $connection = $this->collection->getConnection();

        $rows = $connection->getCollectionData($this->collection->getName(), $this->criteria);

        $this->rows = array_slice($rows, $this->skip, $this->limit);

        foreach ((array) $this->sorts as $field => $flag) {
            usort($this->rows, function($a, $b) use ($field, $flag) {
                if (isset($a[$field])) {
                    $aValue = utf8_encode(filter_var((string) $a[$field], FILTER_SANITIZE_STRING));
                    $bValue = utf8_encode(filter_var((string) $b[$field], FILTER_SANITIZE_STRING));

                    return strcasecmp($aValue, $bValue) * (int) $flag;
                }
            });
        }
    }
432009
public function execute()
    {
        $db = $this->dbHandle;
        $db->/** @scrutinizer ignore-call */
        sqliteCreateFunction('log', 'log', 1);
        $sql = '
		INSERT INTO inverse_document_frequency (term, inverseDocumentFrequency)
		SELECT DISTINCT term, (1+(log(:documentCount / COUNT(documentPath) + 1))) AS inverseDocumentFrequency
					  FROM term_count
				  GROUP BY term
		';

        if (!$stmt = $db->prepare($sql)) {
            $errorInfo = $db->errorInfo();
            $errorMsg = $errorInfo[2];
            throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
        }
        $stmt->bindValue(':documentCount', $this->documentCount);
        $result = $stmt->execute();
        if ($result === false) {
            $errorInfo = $db->errorInfo();
            $errorMsg = $errorInfo[2];
            throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
        }
    }
455089
private function getPreparedInsert()
    {
        if (is_null($this->preparedInsert)) {
            $this->preparedInsert = $this->getServer()
                ->insert($this->tableName, true)
                ->set($this->keyColumnName, ':id')
                ->set($this->valueColumnName, ':value')
                ->set($this->expireColumnName, ':expire');
        }

        return $this->preparedInsert;
    }
816952
public function execute()
    {
        $stmt = $this->pdo->prepare($this->build());

        if ($stmt->execute($this->getValues())) {
            $this->rowCount = $stmt->rowCount();

            return $stmt;
        } else {
            return false;
        }
    }
204864
protected function execute(array $prepared)
    {
        if ($this->logQueries) {
            $start = microtime(true);
            $log = [
                'query' => $this->replaceParams($prepared['query'], $prepared['params']),
            ];
            $this->log[] = &$log;
        }

        try {
            if ($prepared['params']) {
                $this->bindValues($prepared['statement'], $prepared['params']);
            }
            $result = $prepared['statement']->execute();
        } catch (PDOException $e) {
            throw new PDOException($e->getMessage() . ' [ ' . $this->replaceParams($prepared['query'],
                    $prepared['params']) . ' ] ', (int)$e->getCode(), $e->getPrevious());
        }

        if ($this->logQueries) {
            /** @noinspection PhpUndefinedVariableInspection */
            $log['time'] = microtime(true) - $start;
        }

        return $result;
    }
667650
function execute() {
		try {

			// we need to bind in order
			if (empty($this->refactored_stmt)) {
				$index = [];

				$this->refactored_stmt = $this->query;

				# 
				# We need to sort by length to avoid replacing keys that are
				# prefixes of other keys, thereby invaliding the bigger keys
				#

				$keylengths = [];
				foreach (\array_keys($this->params) as $key) {
					$keylengths[$key] = strlen($key);
				}

				\asort($keylengths, SORT_NUMERIC);

				$keys = \array_keys(\array_reverse($keylengths, true));

				foreach ($keys as $key) {
					$position = \strpos($this->query, $key);
					if ($position == false) {
						throw new Panic("Tried to bind parameter $key but it's not present in statement.");
					}

					$this->refactored_stmt = \str_replace($key, '?', $this->refactored_stmt);

					$index[$key] = $position;
				}

				\asort($index, SORT_NUMERIC);

				$this->stmt = \mysqli_prepare($this->dbh, $this->refactored_stmt);

				if ( ! $this->stmt) {
					throw new Panic('Failed to prepare statement');
				}

				$bindings = '';
				$args = [ $this->stmt, null ];
				foreach (array_keys($index) as $key) {
					$bindings .= $this->params[$key][1];
					$args[] = & $this->params[$key][0];
				}

				$args[1] = $bindings;

				if ( ! empty($args[1])) {
					\call_user_func_array('mysqli_stmt_bind_param', $args);
				}
			}
			
			if ( ! \mysqli_stmt_execute($this->stmt)) {
				throw new Panic('Failed to execute statement');
			}

			#
			# to avoid complications with statements not getting closed before
			# new ones are executed we fetch the result set imediatly
			#

			$this->resultset = [];
			$result = \mysqli_stmt_get_result($this->stmt);
			while ($data = mysqli_fetch_assoc($result)) {
				$this->resultset[] = $data;
			}
		}
		catch (\Exception $exception) {
			$message = $exception->getMessage();
			$message .= "\n".$this->formatQuery($this->query);
			throw new Panic($message, 500, $exception);
		}

		return $this;
	}
1273079
public function execute($sql, $params = null)
    {
        $stmt = $this->_pdo->prepare($sql);

        if (is_array($params)) {
            foreach ($params as $token => $value) {
                $stmt->bindValue($token, $value);
            }
        }

        try {
            $stmt->execute();
        } catch (PDOException $exception) {
            $this->_database->error('execute', $exception);
        }

        return $stmt;
    }
1040477
public function build(): ExecuteSQLRequest
	{
		$instance = new ExecuteSQLRequest();
		if ($this->databaseId === null) {
			throw new BuilderException('Property [databaseId] is required.');
		}
		$instance->databaseId = $this->databaseId;
		if ($this->query === null) {
			throw new BuilderException('Property [query] is required.');
		}
		$instance->query = $this->query;
		return $instance;
	}
728615
public function exec()
    {
        $args = func_get_args();

        if (count($args) > 1) {
            $template = array_shift($args);
            $this->currentQuery = vsprintf($template, $args);
        } else {
            $this->currentQuery = $args[0];
        }

        return $this->dbExec();
    }
1324346
public function exec() {
        try {
            $query = $this->db->prepare($this->q->get());
            $this->bindValues($query);
            $query->execute();

            // Set the last inserted id but only
            // of $this->db->lastInsertId() is not empty
            if (!empty($this->db->lastInsertId())) {
                $this->lastInsertId = $this->db->lastInsertId();
            }

            $this->clear();

            return true;
        } catch (\PDOException $e) {
            $this->setError('d', $e->getMessage());
            return false;
        }
    }
656064
protected function prepare()
    {
        $this
            ->getSession()
            ->getConnection()
            ->sendPrepareQuery(
                $this->getClientIdentifier(),
                $this->orderParameters($this->sql)
            );
        $this->is_prepared = true;

        return $this;
    }
1359238
public function prepareAndExecuteSql($sql, $binds = [])
    {
        $prepare = $this->prepareSQL($sql, $binds);

        return $this->executePrepared($prepare);
    }
993521
final public function prepare()
    {

        $DB = $this->DBO;
        $QUERY = $this->compile();

        //echo $QUERY;
        //Compile the query;
        $STATEMENT = $DB->prepare($QUERY);

        //Return the Result Object;
        return $STATEMENT;
    }
1059063
public function prepare(string $statement) : PreparedStatementInterface
    {
        try {
            $preparedStatement = $this->getConnection()->prepare($statement);
            return new PdoPreparedStatement($preparedStatement);
        } catch (\PDOException $e) {
            throw new ParserRuntimeException('Statement could not be prepared.', 0, $e);
        }
    }
949900
public function execute()
	{
		// Check connection
		$this->hasConnectionOrFail();

		// Capture the start time
		$start = microtime(true);

		// Execute the query
		try
		{
			$this->statement->execute();
		}
		catch (\PDOException $e)
		{
			// @FIXME: this should honor error reporting settings
			throw new QueryFailedException($e->getMessage(), 500, $e);
		}

		if ($this->debug)
		{
			// Log it
			$this->log(microtime(true) - $start);
		}

		return $this;
	}
1051564
public function execute() {
        if (!$this->checkExists()) {
            if ($this->current === self::OP_SELECT) {
                return new ArrayCollection();
            }

            return false;
        }
        $this->createQuery();

        $model = ($this->expected) ? $this->getRowModel() : null;
        if ($this->current === self::OP_SELECT && $this->isCached()) {
            $result = $this->getCached();
        }
        if (!$result) {
            if ($this->preserveQueries && $this->current !== self::OP_SELECT) // keep all queries except selects
                    $this->doPreserveQueries();
            $result = $this->connection->doPrepare($this->query, $this->values,
                    array(
                'multipleRows' => $this->multiple,
                'model' => $model
            ));

            if ($this->current === self::OP_SELECT) $this->saveCache($result);
            else $this->removeCache();
        }

        if ($this->current === self::OP_SELECT)
                $result = $this->returnSelect($result);
        $this->lastQuery = $this->query . '<pre><code>' . print_r($this->values,
                        true) . '</code></pre>';
        $this->resetQuery();
        return $result;
    }