Ejemplo n.º 1
0
 public function query($sql, $mode = MYSQLI_STORE_RESULT)
 {
     $this->_QSQL[] = $sql;
     Mdl_Mysql_Safecheck::checkquery($sql);
     if ($rs = $this->query($sql, $mode)) {
         return new Mdl_Mysqli_Result($rs);
     }
     $this->_ERR[] = $this->errno . ':' . $this->error;
     return false;
     $this->connect();
     if (__CFG::DEBUG) {
         $starttime = microtime(true);
     }
     $rs = parent::query($sql, $mode);
     if (__CFG::DEBUG) {
         $errno = $this->errno;
         $exec_time = number_format(microtime(true) - $starttime, 6);
         $this->total_exec_time += $exec_time;
         $this->_QSQL[] = array($sql, $exec_time, $this->link, $errno);
         if ($errno > 0) {
             $this->_ESQL[] = array($sql, $this->mysql_debug_backtrace(), $errno, $this->error);
         }
     }
     if (preg_match("/(SELECT|SHOW|DESCRIBE|EXPLAIN)\\s+/i", $sql, $match)) {
         return new Mdl_Mysqli_Result($rs);
     }
     return $rs;
 }
Ejemplo n.º 2
0
 public function safe_query($sql)
 {
     Mdl_Mysql_Safecheck::checkquery($sql);
     return $this->query($sql);
 }