/** * @param DB_Cursor $cursor */ public function on_execute(DB_Cursor $cursor) { $time = Time::now()->as_string(); $this->stream->format("sql %s %f %d %s\n", $time, $cursor->execution_time, $cursor->num_of_rows, str_replace("\n", ' ', $cursor->sql)); if ($this->explain) { foreach ($cursor->explain() as $e) { $this->stream->format("exp %s %d %s %s [%s] %d %s %s %d [%s]\n", $time, $e->id, $e->select_type, $e->table, Core::if_null($e->possible_keys, '-'), Core::if_null($e->key_len, '-'), Core::if_null($e->key, '-'), Core::if_null($e->ref, '-'), Core::if_null($e->rows, '-'), Core::if_null($e->extra, '')); } } }
public function on_execute(DB_Cursor $cursor) { if (!$this->skip && $cursor->is_successful) { $this->query[] = $cursor->pure_sql(); } $this->skip = false; }