- $res = mysql_query($query);
-
- if ($globals->debug & 1) {
- list($ue, $se) = explode(" ", microtime());
- list($us, $ss) = explode(" ", $time_start);
- $time = intval((($ue - $us) + ($se - $ss)) * 1000);
- $trace_data['error'] = mysql_error();
- $trace_data['exectime'] = $time;
- $trace_data['rows'] = @mysql_num_rows() ? mysql_num_rows() : mysql_affected_rows();
- $GLOBALS['XDB::trace_data'][] = $trace_data;
- if (mysql_errno()) {
- $GLOBALS['XDB::error'] = true;
+ if ($globals->debug & DEBUG_BT) {
+ $explain = array();
+ if (strpos($query, 'FOUND_ROWS()') === false) {
+ $res = XDB::$mysqli->query("EXPLAIN $query");
+ if ($res) {
+ while ($row = $res->fetch_assoc()) {
+ $explain[] = $row;
+ }
+ $res->free();
+ }