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')));
});
}