From e24caa758890e0a753c0be9293a09f5d2931e377 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 19 Jun 2015 20:57:39 +0200 Subject: small cleanup * keep all com_xxx constants together in struct system_status_var * fix an outdated comment in sql_cmd.h * fix an off-by-one bug in mysqld.cc --- sql/mysqld.cc | 2 +- sql/sql_class.h | 19 ++++++++++--------- sql/sql_cmd.h | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 157809404a4..ac72132f531 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3919,7 +3919,7 @@ void init_sql_statement_info() while (var->name != NULL) { ptr= (size_t)(var->value); - if ((first_com <= ptr) && (ptr <= last_com)) + if ((first_com <= ptr) && (ptr < last_com)) { com_index= ((int)(ptr - first_com))/record_size; DBUG_ASSERT(com_index < (uint) SQLCOM_END); diff --git a/sql/sql_class.h b/sql/sql_class.h index 0d4f36a19d4..0306a8c609e 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -674,8 +674,17 @@ typedef struct system_variables typedef struct system_status_var { - ulong com_other; ulong com_stat[(uint) SQLCOM_END]; + ulong com_other; + + ulong com_stmt_prepare; + ulong com_stmt_reprepare; + ulong com_stmt_execute; + ulong com_stmt_send_long_data; + ulong com_stmt_fetch; + ulong com_stmt_reset; + ulong com_stmt_close; + ulong created_tmp_disk_tables_; ulong created_tmp_tables_; ulong ha_commit_count; @@ -728,14 +737,6 @@ typedef struct system_status_var ulong filesort_rows_; ulong filesort_scan_count_; ulong filesort_pq_sorts_; - /* Prepared statements and binary protocol */ - ulong com_stmt_prepare; - ulong com_stmt_reprepare; - ulong com_stmt_execute; - ulong com_stmt_send_long_data; - ulong com_stmt_fetch; - ulong com_stmt_reset; - ulong com_stmt_close; /* Features used */ ulong feature_dynamic_columns; /* +1 when creating a dynamic column */ diff --git a/sql/sql_cmd.h b/sql/sql_cmd.h index dcc0b3303d8..904578134b4 100644 --- a/sql/sql_cmd.h +++ b/sql/sql_cmd.h @@ -96,7 +96,7 @@ enum enum_sql_command { /* When a command is added here, be sure it's also added in mysqld.cc - in "struct show_var_st status_vars[]= {" ... + in "struct show_var_st com_status_vars[]= {" ... */ /* This should be the last !!! */ SQLCOM_END -- cgit v1.2.1