Esempio n. 1
0
 public function query($sql, $orm = FALSE)
 {
     // If SQL statement is a SELECT statement
     if (preg_match('/^SELECT/is', $sql)) {
         $res = $this->con->prepare($sql);
         //$res->setFetchMode(PDO::FETCH_ASSOC);
         if ($orm) {
             load::orm_class($orm);
             $res->setFetchMode(PDO::FETCH_CLASS, $orm . '_orm');
         } else {
             $res->setFetchMode(PDO::FETCH_CLASS, 'dingo');
         }
         $res->execute();
         $this->last_result = $res->fetchAll();
     } else {
         $this->last_result = $this->con->exec($sql);
     }
     return $this->last_result;
 }