Minor edits in con.php/COPYING
[specialops2.git] / lib / class.debugmysqli.php
blob2cf0397b5ceb99c660e4eee2ea600b17a71cadd0
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);
14 if ( $this->warning_count ) {
15 $result2 = $this->query('SHOW WARNINGS');
16 $out = '';
17 while ( $row = $result2->fetch_row() )
18 $out .= vsprintf("%s #%s: %s\n", $row);
19 throw new RuntimeException("MySQLi query() warning(s)\n".$out."\nQuery given was: \n".$q, E_USER_WARNING);
21 $this->c++;
22 return $result;
25 public function prepare($q)
27 $result = parent::prepare($q);
28 if ( $this->error )
29 throw new RuntimeException("MySQLi prepare() error\n".$this->error."\nQuery given was: \n".$q, E_USER_ERROR);
31 $this->c++;
32 return $result;
35 public function getTotalQueries()
37 return $this->c;