Skip to content

Commit

Permalink
small cleanup
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
vuvova committed Jun 27, 2015
1 parent c47acc2 commit e24caa7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion sql/mysqld.cc
Expand Up @@ -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);
Expand Down
19 changes: 10 additions & 9 deletions sql/sql_class.h
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_cmd.h
Expand Up @@ -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
Expand Down

0 comments on commit e24caa7

Please sign in to comment.