includes/dbal.php
changeset 902 e7c6f1aa7b6a
parent 879 9788f2b7e08a
child 940 645727469415
equal deleted inserted replaced
901:99ea0b0ac4be 902:e7c6f1aa7b6a
   475     if(!$this->_conn) return false;
   475     if(!$this->_conn) return false;
   476     if(!$r) $r = $this->latest_result;
   476     if(!$r) $r = $this->latest_result;
   477     if(!$r) $this->_die('$db->fetchrow(): an invalid MySQL resource was passed.');
   477     if(!$r) $this->_die('$db->fetchrow(): an invalid MySQL resource was passed.');
   478     return mysql_num_rows($r);
   478     return mysql_num_rows($r);
   479   }
   479   }
   480   function sql_affectedrows($r = false, $f, $n)
   480   function sql_affectedrows($r = false, $f = false, $n = false)
   481   {
   481   {
   482     if(!$this->_conn) return false;
   482     if(!$this->_conn) return false;
   483     if(!$r) $r = $this->latest_result;
   483     if(!$r) $r = $this->latest_result;
   484     if(!$r) $this->_die('$db->fetchrow(): an invalid MySQL resource was passed.');
   484     if(!$r) $this->_die('$db->fetchrow(): an invalid MySQL resource was passed.');
   485     return mysql_affected_rows();
   485     return mysql_affected_rows();
   965       $this->report_query($q);
   965       $this->report_query($q);
   966       grinding_halt('SQL Injection attempt', '<p>Enano has caught and prevented an SQL injection attempt. Your IP address has been recorded and the administrator has been notified.</p><p>Query was:</p><pre>'.htmlspecialchars($q).'</pre>');
   966       grinding_halt('SQL Injection attempt', '<p>Enano has caught and prevented an SQL injection attempt. Your IP address has been recorded and the administrator has been notified.</p><p>Query was:</p><pre>'.htmlspecialchars($q).'</pre>');
   967     }
   967     }
   968     
   968     
   969     $time_start = microtime_float();
   969     $time_start = microtime_float();
   970     $r = @pg_query($q);
   970     $r = @pg_query($this->_conn, $q);
   971     $this->query_times[$q] = microtime_float() - $time_start;
   971     $this->query_times[$q] = microtime_float() - $time_start;
   972     $this->latest_result = $r;
   972     $this->latest_result = $r;
   973     return $r;
   973     return $r;
   974   }
   974   }
   975   
   975   
  1183   }
  1183   }
  1184   function sql_numrows($r = false)
  1184   function sql_numrows($r = false)
  1185   {
  1185   {
  1186     return $this->numrows();
  1186     return $this->numrows();
  1187   }
  1187   }
  1188   function sql_affectedrows($r = false, $f, $n)
  1188   function sql_affectedrows($r = false, $f = false, $n = false)
  1189   {
  1189   {
  1190     if(!$this->_conn) return false;
  1190     if(!$this->_conn) return false;
  1191     if(!$r) $r = $this->latest_result;
  1191     if(!$r) $r = $this->latest_result;
  1192     if(!$r) $this->_die('$db->fetchrow(): an invalid ' . $this->dbms_name . ' resource was passed.');
  1192     if(!$r) $this->_die('$db->fetchrow(): an invalid ' . $this->dbms_name . ' resource was passed.');
  1193     return pg_affected_rows();
  1193     return pg_affected_rows();