Commit dacc7b53 authored by unknown's avatar unknown

make multi updates statistics visible in SHOW STATUS as Com_update_multi

parent 1d1b1819
......@@ -4048,6 +4048,7 @@ struct show_var_st status_vars[]= {
{"Com_truncate", (char*) (com_stat+(uint) SQLCOM_TRUNCATE),SHOW_LONG},
{"Com_unlock_tables", (char*) (com_stat+(uint) SQLCOM_UNLOCK_TABLES),SHOW_LONG},
{"Com_update", (char*) (com_stat+(uint) SQLCOM_UPDATE),SHOW_LONG},
{"Com_update_multi", (char*) (com_stat+(uint) SQLCOM_UPDATE_MULTI),SHOW_LONG},
{"Connections", (char*) &thread_id, SHOW_LONG_CONST},
{"Created_tmp_disk_tables", (char*) &created_tmp_disk_tables,SHOW_LONG},
{"Created_tmp_tables", (char*) &created_tmp_tables, SHOW_LONG},
......
......@@ -1894,8 +1894,6 @@ mysql_execute_command(THD *thd)
send_error(thd,ER_WRONG_VALUE_COUNT);
DBUG_VOID_RETURN;
}
if (select_lex->table_list.elements == 1)
{
res= mysql_update(thd,tables,
select_lex->item_list,
lex->value_list,
......@@ -1903,15 +1901,23 @@ mysql_execute_command(THD *thd)
(ORDER *) select_lex->order_list.first,
select_lex->select_limit,
lex->duplicates);
break;
case SQLCOM_UPDATE_MULTI:
if (check_access(thd,UPDATE_ACL,tables->db,&tables->grant.privilege))
goto error;
if (grant_option && check_grant(thd,UPDATE_ACL,tables))
goto error;
if (select_lex->item_list.elements != lex->value_list.elements)
{
send_error(thd,ER_WRONG_VALUE_COUNT);
DBUG_VOID_RETURN;
}
else
{
multi_update *result;
uint table_count;
TABLE_LIST *auxi;
const char *msg=0;
lex->sql_command=SQLCOM_UPDATE_MULTI;
for (auxi= (TABLE_LIST*) tables, table_count=0 ; auxi ; auxi=auxi->next)
table_count++;
......
......@@ -3061,6 +3061,8 @@ update:
SET update_list where_clause opt_order_clause delete_limit_clause
{
Select->set_lock_for_tables($3);
if (lex->select_lex->table_list.elements > 1)
lex->sql_command=SQLCOM_UPDATE_MULTI;
}
;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment