Example #1
0
 /**
  * Execute the SQL query.
  *
  * @param  string $sql
  * @throws Exception
  * @return void
  */
 public function query($sql)
 {
     if ($this->isPdo) {
         $sth = $this->sqlite->prepare($sql);
         if (!$sth->execute()) {
             throw new Exception($sth->errorCode() . ': ' . $sth->errorInfo());
         } else {
             $this->result = $sth;
         }
     } else {
         if (!($this->result = $this->sqlite->query($sql))) {
             throw new Exception('Error: ' . $this->sqlite->lastErrorCode() . ': ' . $this->sqlite->lastErrorMsg() . '.');
         }
     }
 }