/** * Execute query. * * Execute the specified query. * * @since 1.1.0 Added $object parameter. * @since 1.0.0 * @access public * * @param Freyja\Database\Query\Query $query Query to execute. * @param string|bool $object Optional. If set, fetches results as the specified * object type (string) or StdClass (true). Default false. * @return self * * @throws Freyja\Exceptions\RuntimeException if it's raised by * Freyja\Database\Driver::execute(). */ public function execute(Query $query, $object = false) { if (!$query->hasResult()) { try { $result = $this->driver->execute($query, $object); } catch (Exception $e) { throw $e; } $query->setResult($result); } $this->last = $query; return $this; }