lithium\data\source\database\adapter\MySql::_execute PHP Метод

_execute() защищенный Метод

Execute a given query.
См. также: lithium\data\source\Database::renderCommand()
protected _execute ( string $sql, array $options = [] ) : Result
$sql string The sql string to execute
$options array Available options: - 'buffered': If set to `false` uses mysql_unbuffered_query which sends the SQL query query to MySQL without automatically fetching and buffering the result rows as `mysql_query()` does (for less memory usage).
Результат lithium\data\source\Result Returns a result object if the query was successful.
    protected function _execute($sql, array $options = array())
    {
        $defaults = array('buffered' => true);
        $options += $defaults;
        $conn = $this->connection;
        $params = compact('sql', 'options');
        return $this->_filter(__METHOD__, $params, function ($self, $params) use($conn) {
            $sql = $params['sql'];
            $options = $params['options'];
            $conn->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, $options['buffered']);
            try {
                $resource = $conn->query($sql);
            } catch (PDOException $e) {
                $self->invokeMethod('_error', array($sql));
            }
            return $self->invokeMethod('_instance', array('result', compact('resource')));
        });
    }