Example #1
0
 public function execute($statement)
 {
     Ac::timerStart();
     $this->connect();
     list($_this, $statement) = Ac::trigger(__CLASS__ . "_before_" . __FUNCTION__, array($this, trim($statement)));
     $this->last_row_count = 0;
     $this->beginTransaction();
     $this->last_row_count = $this->pdo->exec($statement);
     if ($this->last_row_count > 0) {
         $this->clearCache();
     }
     $this->num_operations++;
     if (!$this->isError()) {
         $this->commit();
         $status = "success";
         if ($this->getConfig("log_success")) {
             $this->log($statement, "OK", null);
         }
     } else {
         $this->rollback();
         $status = "error";
         if ($this->getConfig("log_errors")) {
             $this->log($statement, $this->pdo->errorInfo(), null);
         }
     }
     Ac::trigger(__CLASS__ . "_on_" . __FUNCTION__, array($this, $statement, $status, $this->last_row_count));
     return $this->last_row_count;
 }