Commit ae48f5fd authored by unknown's avatar unknown
Browse files

fix for bug#16407 (EVENTS: sql_mode)

post-review fixes


mysql-test/r/events_bugs.result:
  fix result
sql/event.cc:
  fix compilation problem on windows
sql/event_executor.cc:
  show the right host in show processlist (should be event_scheduler@localhost)
sql/event_timed.cc:
  a bit more debug infor
  fix a problem introduced with previous push :( . clean everything that's whitespace.
  found because of new test cases which were crashing.
sql/sql_show.cc:
  fix compile problem on windows
parent e41f5cc4
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -18,8 +18,8 @@ end|
show processlist;
Id	User	Host	db	Command	Time	State	Info
#	root	localhost	events_test	Query	#	NULL	show processlist
#	event_scheduler		NULL	Connect	#	Sleeping	NULL
#	root		events_test	Connect	#	User lock	select get_lock('test_bug16407', 60)
#	event_scheduler	localhost	NULL	Connect	#	Sleeping	NULL
#	root	localhost	events_test	Connect	#	User lock	select get_lock('test_bug16407', 60)
select release_lock('test_bug16407');
release_lock('test_bug16407')
1
@@ -72,17 +72,17 @@ set global event_scheduler= 1;
show processlist;
Id	User	Host	db	Command	Time	State	Info
#	root	localhost	events_test	Query	#	NULL	show processlist
#	event_scheduler		NULL	Connect	#	Sleeping	NULL
#	root		events_test	Connect	#	User lock	select get_lock('ee_16407_2', 60)
#	root		events_test	Connect	#	User lock	select get_lock('ee_16407_2', 60)
#	root		events_test	Connect	#	User lock	select get_lock('ee_16407_2', 60)
#	event_scheduler	localhost	NULL	Connect	#	Sleeping	NULL
#	root	localhost	events_test	Connect	#	User lock	select get_lock('ee_16407_2', 60)
#	root	localhost	events_test	Connect	#	User lock	select get_lock('ee_16407_2', 60)
#	root	localhost	events_test	Connect	#	User lock	select get_lock('ee_16407_2', 60)
select release_lock('ee_16407_2');
release_lock('ee_16407_2')
1
show processlist;
Id	User	Host	db	Command	Time	State	Info
#	root	localhost	events_test	Query	#	NULL	show processlist
#	event_scheduler		NULL	Connect	#	Sleeping	NULL
#	event_scheduler	localhost	NULL	Connect	#	Sleeping	NULL
set global event_scheduler= 0;
select * from events_smode_test order by ev_name, a;
ev_name	a
@@ -121,16 +121,16 @@ set global event_scheduler= 1;
show processlist;
Id	User	Host	db	Command	Time	State	Info
#	root	localhost	events_test	Query	#	NULL	show processlist
#	event_scheduler		NULL	Connect	#	Sleeping	NULL
#	root		events_test	Connect	#	User lock	select get_lock('ee_16407_5', 60)
#	root		events_test	Connect	#	User lock	select get_lock('ee_16407_5', 60)
#	event_scheduler	localhost	NULL	Connect	#	Sleeping	NULL
#	root	localhost	events_test	Connect	#	User lock	select get_lock('ee_16407_5', 60)
#	root	localhost	events_test	Connect	#	User lock	select get_lock('ee_16407_5', 60)
select release_lock('ee_16407_5');
release_lock('ee_16407_5')
1
show processlist;
Id	User	Host	db	Command	Time	State	Info
#	root	localhost	events_test	Query	#	NULL	show processlist
#	event_scheduler		NULL	Connect	#	Sleeping	NULL
#	event_scheduler	localhost	NULL	Connect	#	Sleeping	NULL
select * from events_smode_test order by ev_name, a;
ev_name	a
ee_16407_6	2004-02-29
+1 −1
Original line number Diff line number Diff line
@@ -1384,7 +1384,7 @@ evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer)
    char show_str_buf[768];
    String show_str(show_str_buf, sizeof(show_str_buf), system_charset_info);
    List<Item> field_list;
    const char *sql_mode_str;
    byte *sql_mode_str;
    ulong sql_mode_len=0;
    
    show_str.length(0);
+1 −1
Original line number Diff line number Diff line
@@ -268,7 +268,7 @@ init_event_thread(THD* thd)
  thd->client_capabilities= 0;
  thd->security_ctx->master_access= 0;
  thd->security_ctx->db_access= 0;
  thd->security_ctx->host= (char*)my_localhost;
  thd->security_ctx->host_or_ip= (char*)my_localhost;
  my_net_init(&thd->net, 0);
  thd->net.read_timeout = slave_net_timeout;
  thd->slave_thread= 0;
+9 −5
Original line number Diff line number Diff line
@@ -111,17 +111,21 @@ void
event_timed::init_body(THD *thd)
{
  DBUG_ENTER("event_timed::init_body");
  MEM_ROOT *root= thd->mem_root;
  DBUG_PRINT("info", ("body=[%s] body_begin=0x%ld end=0x%ld", body_begin,
             body_begin, thd->lex->ptr));

  body.length= thd->lex->ptr - body_begin;
  // Trim nuls at the end
  while (body.length && body_begin[body.length-1] == '\0')
    body.length--;

  //the first is always space which I cannot skip in the parser
  DBUG_ASSERT(my_isspace(thd->variables.character_set_client, *body_begin));
  body.length--;
  body.str= strmake_root(root, (char *)body_begin + 1, body.length);
  /* the first is always whitespace which I cannot skip in the parser */
  while (my_isspace(thd->variables.character_set_client, *body_begin))
  {
    ++body_begin;
    --body.length;
  }
  body.str= strmake_root(thd->mem_root, (char *)body_begin, body.length);

  DBUG_VOID_RETURN;
}
+1 −1
Original line number Diff line number Diff line
@@ -3956,7 +3956,7 @@ fill_events_copy_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table)

  // [9] is SQL_MODE 
  {
    const char *sql_mode_str="";
    byte *sql_mode_str;
    ulong sql_mode_len=0;
    sql_mode_str=
           sys_var_thd_sql_mode::symbolic_mode_representation(thd, et.sql_mode,