fixed broken user.php
[specialops2.git] / lib / class.debugmysqli.php
blob6dbe403db0608c83a6b638e571835f6d9ec53e10
1 <?php
2 // $Id$
4 class debugmysqli extends mysqli
6 public $c;
8 public function query($q)
10 $result = parent::query($q);
11 if ( $this->error ) {
12 throw new RuntimeException("MySQLi query() error!\n".$this->error."\nQuery given was: \n".$q, E_USER_ERROR);
15 if ( $this->warning_count ) {
16 $result2 = $this->query('SHOW WARNINGS');
17 $out = '';
18 while ( $row = $result2->fetch_row() )
19 $out .= $row[0].' #'.$row[1].': '.$row[2]."\n";
20 throw new RuntimeException("MySQLi query() warning!\n".$out."\nQuery given was: \n".$q, E_USER_WARNING);
22 $this->c++;
23 return $result;
26 public function prepare($q)
28 $result = parent::prepare($q);
29 if ( $this->error ) {
30 throw new RuntimeException("MySQLi prepare() error!\n".$this->error."\nQuery given was: \n".$q, E_USER_ERROR);
33 $this->c++;
34 return $result;
37 public function getTotalQueries()
39 return $this->c;