Loading mysql-test/r/information_schema.result +9 −0 Original line number Diff line number Diff line Loading @@ -823,3 +823,12 @@ GRANT SELECT ON *.* TO 'user4'@'localhost' drop user user1@localhost, user2@localhost, user3@localhost, user4@localhost; use test; drop database mysqltest; create procedure p1 () modifies sql data set @a = 5; create procedure p2 () set @a = 5; select sql_data_access from information_schema.routines where specific_name like 'p%'; sql_data_access MODIFIES SQL DATA CONTAINS SQL drop procedure p1; drop procedure p2; mysql-test/t/information_schema.test +10 −0 Original line number Diff line number Diff line Loading @@ -542,3 +542,13 @@ connection default; drop user user1@localhost, user2@localhost, user3@localhost, user4@localhost; use test; drop database mysqltest; # # Bug #11055 information_schema: routines.sql_data_access has wrong value # create procedure p1 () modifies sql data set @a = 5; create procedure p2 () set @a = 5; select sql_data_access from information_schema.routines where specific_name like 'p%'; drop procedure p1; drop procedure p2; sql/sql_lex.h +8 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,14 @@ enum enum_sp_data_access SP_MODIFIES_SQL_DATA }; const LEX_STRING sp_data_access_name[]= { { (char*) STRING_WITH_LEN("") }, { (char*) STRING_WITH_LEN("CONTAINS SQL") }, { (char*) STRING_WITH_LEN("NO SQL") }, { (char*) STRING_WITH_LEN("READS SQL DATA") }, { (char*) STRING_WITH_LEN("MODIFIES SQL DATA") } }; #define DERIVED_SUBQUERY 1 #define DERIVED_VIEW 2 Loading sql/sql_show.cc +3 −4 Original line number Diff line number Diff line Loading @@ -2645,6 +2645,7 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table, restore_record(table, s->default_values); if (!wild || !wild[0] || !wild_compare(sp_name, wild, 0)) { int enum_idx= proc_table->field[5]->val_int(); table->field[3]->store(sp_name, strlen(sp_name), cs); get_field(thd->mem_root, proc_table->field[3], &tmp_string); table->field[0]->store(tmp_string.ptr(), tmp_string.length(), cs); Loading @@ -2666,10 +2667,8 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table, table->field[10]->store("SQL", 3, cs); get_field(thd->mem_root, proc_table->field[6], &tmp_string); table->field[11]->store(tmp_string.ptr(), tmp_string.length(), cs); if (proc_table->field[5]->val_int() == SP_CONTAINS_SQL) { table->field[12]->store("CONTAINS SQL", 12 , cs); } table->field[12]->store(sp_data_access_name[enum_idx].str, sp_data_access_name[enum_idx].length , cs); get_field(thd->mem_root, proc_table->field[7], &tmp_string); table->field[14]->store(tmp_string.ptr(), tmp_string.length(), cs); bzero((char *)&time, sizeof(time)); Loading sql/structs.h +2 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ struct st_table; class Field; #define STRING_WITH_LEN(X) X, (sizeof(X)-1) typedef struct st_lex_string { char *str; Loading Loading
mysql-test/r/information_schema.result +9 −0 Original line number Diff line number Diff line Loading @@ -823,3 +823,12 @@ GRANT SELECT ON *.* TO 'user4'@'localhost' drop user user1@localhost, user2@localhost, user3@localhost, user4@localhost; use test; drop database mysqltest; create procedure p1 () modifies sql data set @a = 5; create procedure p2 () set @a = 5; select sql_data_access from information_schema.routines where specific_name like 'p%'; sql_data_access MODIFIES SQL DATA CONTAINS SQL drop procedure p1; drop procedure p2;
mysql-test/t/information_schema.test +10 −0 Original line number Diff line number Diff line Loading @@ -542,3 +542,13 @@ connection default; drop user user1@localhost, user2@localhost, user3@localhost, user4@localhost; use test; drop database mysqltest; # # Bug #11055 information_schema: routines.sql_data_access has wrong value # create procedure p1 () modifies sql data set @a = 5; create procedure p2 () set @a = 5; select sql_data_access from information_schema.routines where specific_name like 'p%'; drop procedure p1; drop procedure p2;
sql/sql_lex.h +8 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,14 @@ enum enum_sp_data_access SP_MODIFIES_SQL_DATA }; const LEX_STRING sp_data_access_name[]= { { (char*) STRING_WITH_LEN("") }, { (char*) STRING_WITH_LEN("CONTAINS SQL") }, { (char*) STRING_WITH_LEN("NO SQL") }, { (char*) STRING_WITH_LEN("READS SQL DATA") }, { (char*) STRING_WITH_LEN("MODIFIES SQL DATA") } }; #define DERIVED_SUBQUERY 1 #define DERIVED_VIEW 2 Loading
sql/sql_show.cc +3 −4 Original line number Diff line number Diff line Loading @@ -2645,6 +2645,7 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table, restore_record(table, s->default_values); if (!wild || !wild[0] || !wild_compare(sp_name, wild, 0)) { int enum_idx= proc_table->field[5]->val_int(); table->field[3]->store(sp_name, strlen(sp_name), cs); get_field(thd->mem_root, proc_table->field[3], &tmp_string); table->field[0]->store(tmp_string.ptr(), tmp_string.length(), cs); Loading @@ -2666,10 +2667,8 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table, table->field[10]->store("SQL", 3, cs); get_field(thd->mem_root, proc_table->field[6], &tmp_string); table->field[11]->store(tmp_string.ptr(), tmp_string.length(), cs); if (proc_table->field[5]->val_int() == SP_CONTAINS_SQL) { table->field[12]->store("CONTAINS SQL", 12 , cs); } table->field[12]->store(sp_data_access_name[enum_idx].str, sp_data_access_name[enum_idx].length , cs); get_field(thd->mem_root, proc_table->field[7], &tmp_string); table->field[14]->store(tmp_string.ptr(), tmp_string.length(), cs); bzero((char *)&time, sizeof(time)); Loading
sql/structs.h +2 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ struct st_table; class Field; #define STRING_WITH_LEN(X) X, (sizeof(X)-1) typedef struct st_lex_string { char *str; Loading