5 * @author Anthony Parsons (xmpp:ant@specialops.ath.cx)
6 * @license file://../COPYING
9 class debugmysqli
extends so2mysqli
11 public $c; // query counter
12 private $d = false; // debug next query flag
14 public function query($q)
17 mysqli_report(MYSQLI_REPORT_ALL
);
20 $result = parent
::query($q);
23 throw new RuntimeException("MySQLi query() error!\n".$this->error
."\nQuery given was: \n".$q, E_USER_ERROR
);
26 if ( $this->warning_count
) {
27 $result2 = $this->query('SHOW WARNINGS');
30 while ( $row = $result2->fetch_row() ) {
31 $out .= vsprintf("%s #%s: %s\n", $row);
34 throw new RuntimeException("MySQLi query() warning(s)\n".$out."\nQuery given was: \n".$q, E_USER_WARNING
);
41 mysqli_report(MYSQLI_REPORT_OFF
);
47 public function prepare($q)
49 $result = parent
::prepare($q);
52 throw new RuntimeException("MySQLi prepare() error\n".$this->error
."\nQuery given was: \n".$q, E_USER_ERROR
);
60 public function debugnext()
67 * Make sure mysqli_report setting doesn't linger across requests
69 register_shutdown_function('mysqli_report', MYSQLI_REPORT_OFF
);