Dibi\Connection::nativeQuery PHP Méthode

nativeQuery() final public méthode

Executes the SQL query.
final public nativeQuery ( $sql ) : Result | integer
Résultat Result | integer result set object (if any)
    public final function nativeQuery($sql)
    {
        $this->connected || $this->connect();
        \dibi::$sql = $sql;
        $event = $this->onEvent ? new Event($this, Event::QUERY, $sql) : NULL;
        try {
            $res = $this->driver->query($sql);
        } catch (Exception $e) {
            $event && $this->onEvent($event->done($e));
            throw $e;
        }
        if ($res) {
            $res = $this->createResultSet($res);
        } else {
            $res = $this->driver->getAffectedRows();
        }
        $event && $this->onEvent($event->done($res));
        return $res;
    }

Usage Example

 protected function query($sql)
 {
     if (!is_array($sql)) {
         $sql = [$sql];
     }
     foreach ($sql as $query) {
         $this->dibiConnection->nativeQuery($query);
     }
 }
All Usage Examples Of Dibi\Connection::nativeQuery