Executes a Statement and return a Result

@param Statement $statement
@param array $data
@param int $options (Optional)

@return Result
195964
public function query_statement( Statement $statement, array $data, $options = 0 ) {

		$query = call_user_func_array(
			[ $this->wpdb, 'prepare' ],
			array_merge( [ (string) $statement] , $data )
		);
		$result               = $this->query( $query );
		$this->last_statement = $statement;

		return $result;
	}
750216
protected function _executeQuery($sqlQueryString, $options, $needsLastInsertId = false)
    {
        $this->checkConnection();

        try {
            list($sqlQueryString, $options) = $this->_prepareStatement($sqlQueryString, $options);

            $statement = $this->_pdo->prepare($sqlQueryString);

            $this->_preExecuteOptionsCheck($sqlQueryString, $options);

            $this->bindOptionsToStatement($options, $statement);

            $statement->execute(); //options are already bound to query

            $this->_lastCheckTime = time();

            if ($needsLastInsertId)
                $lastInsertId = $this->_pdo->lastInsertId(); // if table has no PRI KEY, there will be 0

        } catch (\PDOException $e) {
            $this->_error($e->getMessage(), FQDBException::PDO_CODE, $e, [$sqlQueryString, $options]);
            return 0; // for static analysis
        }

        $this->reportWarnings($sqlQueryString, $options);

        return isset($lastInsertId) ? $lastInsertId : $statement;
    }
10235
protected function platformPrepareSqlStatement($sqlStatement, array $options = [])
    {
        // Sqlite3::changes() returns 0 for "DELETE FROM TABLE" queries. This hack
        // modifies the query so that it a proper number of affected rows is returned.
        if ($this->isDeleteHack === true && preg_match('/^\s*DELETE\s+FROM\s+(\S+)\s*$/i', $sqlStatement)) {
            return trim($sqlStatement) . ' WHERE 1=1';
        }

        return $sqlStatement;
    }
647453
private void executeJdbcStatements(Connection connection, String configName, String statements, String description) {
        Statement stmt = createStatement(configName, connection);
        try {
            log.debug("Executing statement [" + description + "]");
            
            List<String> stmtsToExecute = Stream.of(statements.split(";"))
                    .map(String::trim)
                    .filter(s -> s.length() > 0)
                    .collect(Collectors.toList());
            
            if ( log.isTraceEnabled()) {
                log.trace("These statements will be executed:");
                stmtsToExecute.forEach(s -> log.trace("Statement: [" + s + "]"));
            }
            
            for ( String currentStatement : stmtsToExecute) {
                stmt.execute(currentStatement);
                log.trace("Executing statement: " + currentStatement + " OK!");
            }
            
        } catch (SQLException e) {
            throw new ChorusException(
                    String.format("Failed while executing statement [%s] on database + %s [%s]", description, configName, e.toString(), e)
            );
        }
    }
900874
public function single(string $statement, array $params = [])
    {
        if (!$this->is1DArray($params)) {
            throw new Issues\MustBeOneDimensionalArray(
                'Only one-dimensional arrays are allowed.'
            );
        }
        $stmt = $this->prepare($statement);
        $stmt->execute($params);
        return $stmt->fetchColumn(0);
    }
760811
public int executeRawNoArgs(DatabaseConnection connection, String statement) throws SQLException {
		logger.debug("running raw execute statement: {}", statement);
		return connection.executeStatement(statement, DatabaseConnection.DEFAULT_RESULT_FLAGS);
	}
902071
public function execute( $query, array $data = [ ] )
    {
        $result = NULL;

        $statement = $this->database->prepare( $query );

        if ( FALSE === $statement )
        {
            $this->close();

            throw new DatabaseException( 'Failed to create prepared statement.' );
        }

        $result = $statement->execute( $data );

        $this->query = $statement->queryString;

        if ( FALSE !== $result )
        {
            $result = ( int ) $statement->rowCount();
        }

        return $result;
    }
702735
public function prepare($statement, $options = [])
    {
        // numbering placeholder to named placeholder.
        $statement = preg_replace_callback('/(^|\s|,)?\?(,|\s|$)?/', array($this, 'replaceNumberedHolder'), $statement);

        $sth = parent::prepare($statement, $options);
        $sth->setConnection($this);
        $this->count_numbered = 0;

        return $sth;
    }
145107
public static function execute( $sql, $parameters = null, $connection = null, $fetchMode = \PDO::FETCH_ASSOC )
    {
        self::$_statement = self::createStatement( $sql, $connection, $fetchMode );

        if ( empty( $parameters ) )
        {
            return self::$_statement->execute();
        }

        return self::$_statement->execute( $parameters );
    }
1268504
public function insert($data, $statements = null)
    {
        $this->settings['type'] = 'INSERT';
        $this->settings['data'] = $data;
        $this->settings['statements'] = $statements;

        return $this;
    }
880674
public function update($data,$options) {
        $this->model  =   $options['model'];
        $this->parseBind(!empty($options['bind'])?$options['bind']:array());
        $sql   = 'UPDATE '
            .$this->parseTable($options['table'])
            .$this->parseSet($data)
            .$this->parseWhere(!empty($options['where'])?$options['where']:'')
            .$this->parseLock(isset($options['lock'])?$options['lock']:false)
            .$this->parseComment(!empty($options['comment'])?$options['comment']:'');
        return $this->execute($sql,!empty($options['fetch_sql']) ? true : false);
    }
979720
public function query($statement, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = null, array $ctorargs = [])
    {
        $result = $this->client->query($statement, self::$options['timeout']);

        if ($result === false) {
            throw new PDOException($this->client->error, $this->client->errno);
        }

        return $result;
    }
179038
public function query(string $query_string, array $params = [], array $options = []) : DAO
    {
        // Reset in case a previous query was attempted.
        $this->query_succeeded = false;

        // Connect to the database
        if (!$this->is_connected) {
            $this->connect();
        }

        try {
            $stmt = $this->getStatement($query_string);
            $this->stmt = $stmt;
            $stmt->execute($params);
        } catch (DatabaseQueryException $e) {
            throw $e;
        } catch (\Exception $e) {
            throw new DatabaseQueryException($e->getMessage() . '|| QUERY: ' . $query_string);
        }

        $this->query_succeeded = $this->stmt->querySucceeded();

        return $this;
    }
341873
public function exec($statement) {
		try {
			return $this->pdo->exec($statement);
		} catch (PDOException $e) {
			throw $this->exceptionAdapter->adapt($e, $statement);
		}
	}
734477
public function exec(string $statement) : bool
    {
        try {
            return ($this->getConnection()->exec($statement) !== false);
        } catch (\PDOException $e) {
            throw new ParserRuntimeException('Statement could not be executed.', 0, $e);
        }
    }
812171
protected function executeShowDatabases(ShowJob $statement, array $parameters = array())
    {
        $result = new TemporaryResult(['DATABASE']);

        $list = $this->schemaManager->listSchemas();
        sort($list);

        foreach ($list as $schemaId) {
            $result->addRow([$schemaId]);
        }

        return $result;
    }
1088994
public function statement($query, $bindings = array(), $rawResults = false)
    {
        return $this->run($query, $bindings, function(self $me, $query, array $bindings) use($rawResults)
        {
            if ($me->pretending()) return true;

            $statement = $me->getCypherQuery($query, $bindings);

            $result = $statement->getResultSet();

            return ($rawResults === true) ? $result : $result instanceof ResultSet;
        });
    }