Ejemplo n.º 1
0
 /**
  * Wrapper for running queries to generate user feedback on updates
  *
  * @param string $sql SQL query to run on the database
  * @return mixed Query result from db->sql_query()
  */
 protected function sql_query($sql)
 {
     $this->queries[] = $sql;
     $this->db->sql_return_on_error(true);
     if ($sql === 'begin') {
         $result = $this->db->sql_transaction('begin');
     } else {
         if ($sql === 'commit') {
             $result = $this->db->sql_transaction('commit');
         } else {
             $result = $this->db->sql_query($sql);
             if ($this->db->get_sql_error_triggered()) {
                 $this->errors[] = array('sql' => $this->db->get_sql_error_sql(), 'code' => $this->db->get_sql_error_returned());
             }
         }
     }
     $this->db->sql_return_on_error(false);
     return $result;
 }