Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/mysql/plugin_audit.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ struct mysql_event_general
MYSQL_LEX_CSTRING general_sql_command;
MYSQL_LEX_CSTRING general_external_user;
MYSQL_LEX_CSTRING general_ip;
MYSQL_LEX_CSTRING general_database;
unsigned long long general_examined_row_count;
unsigned long long general_affected_row_count;
unsigned long long general_return_row_count;
};

/**
Expand Down
4 changes: 4 additions & 0 deletions include/mysql/plugin_audit.h.pp
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,10 @@
MYSQL_LEX_CSTRING general_sql_command;
MYSQL_LEX_CSTRING general_external_user;
MYSQL_LEX_CSTRING general_ip;
MYSQL_LEX_CSTRING general_database;
unsigned long long general_examined_row_count;
unsigned long long general_affected_row_count;
unsigned long long general_return_row_count;
};
typedef enum
{
Expand Down
8 changes: 8 additions & 0 deletions sql/sql_audit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,14 @@ int mysql_audit_notify(THD *thd, mysql_event_general_subclass_t subclass,
event.general_external_user= sctx->external_user();
event.general_rows= thd->get_stmt_da()->current_row_for_condition();
event.general_sql_command= sql_statement_names[thd->lex->sql_command];
event.general_database= thd->db();
event.general_examined_row_count= thd->get_examined_row_count();
if (thd->get_row_count_func() < 0) {
event.general_affected_row_count= 0;
} else {
event.general_affected_row_count= thd->get_row_count_func();
}
event.general_return_row_count= thd->get_sent_row_count();

thd_get_audit_query(thd, &event.general_query,
(const charset_info_st**)&event.general_charset);
Expand Down