diff options
author | unknown <anozdrin@mysql.com> | 2006-01-13 19:09:27 +0300 |
---|---|---|
committer | unknown <anozdrin@mysql.com> | 2006-01-13 19:09:27 +0300 |
commit | 848235f797cbbc2e16cb132b67177a6728e6735d (patch) | |
tree | c39f4747f6c64b9a61a4edb4ab053adc98010ea0 /sql | |
parent | 4a114543d5ea588a69f74418fc0cb472a519ebda (diff) | |
parent | 9d2def68963e2ecf578eeac0fb376b5d006073c5 (diff) | |
download | mariadb-git-848235f797cbbc2e16cb132b67177a6728e6735d.tar.gz |
Merge BUG#15110 from 5.0 into 5.1.
Merge mysql.com:/home/alik/MySQL/devel/5.0-bug15110
into mysql.com:/home/alik/MySQL/devel/5.1-bug15110
BitKeeper/etc/ignore:
auto-union
client/mysqldump.c:
Auto merged
include/mysql_com.h:
Auto merged
mysql-test/r/mysqldump.result:
Auto merged
mysql-test/r/type_time.result:
Auto merged
sql/Makefile.am:
Auto merged
sql/sp.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_trigger.cc:
Auto merged
client/Makefile.am:
Add my_user.c
include/Makefile.am:
Add my_user.c
libmysqld/Makefile.am:
Add my_user.c
mysql-test/t/disabled.def:
Enable type_time.test
sql/sql_parse.cc:
Merge.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/Makefile.am | 4 | ||||
-rw-r--r-- | sql/sp.cc | 4 | ||||
-rw-r--r-- | sql/sp_head.cc | 30 | ||||
-rw-r--r-- | sql/sql_acl.cc | 4 | ||||
-rw-r--r-- | sql/sql_class.cc | 7 | ||||
-rw-r--r-- | sql/sql_parse.cc | 18 | ||||
-rw-r--r-- | sql/sql_show.cc | 6 | ||||
-rw-r--r-- | sql/sql_trigger.cc | 2 |
8 files changed, 38 insertions, 37 deletions
diff --git a/sql/Makefile.am b/sql/Makefile.am index 4dd1e2bad9c..bd4c34fe224 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -96,7 +96,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ stacktrace.c repl_failsafe.h repl_failsafe.cc \ sql_olap.cc sql_view.cc \ gstream.cc spatial.cc sql_help.cc sql_cursor.cc \ - tztime.cc my_time.c my_decimal.cc\ + tztime.cc my_time.c my_user.c my_decimal.cc\ sp_head.cc sp_pcontext.cc sp_rcontext.cc sp.cc \ sp_cache.cc parse_file.cc sql_trigger.cc \ event_executor.cc event.cc event_timed.cc \ @@ -140,6 +140,8 @@ link_sources: mysql_tzinfo_to_sql.cc @LN_CP_F@ $(top_srcdir)/sql-common/client.c client.c rm -f my_time.c @LN_CP_F@ $(top_srcdir)/sql-common/my_time.c my_time.c + rm -f my_user.c + @LN_CP_F@ $(top_srcdir)/sql-common/my_user.c my_user.c mysql_tzinfo_to_sql.o: $(mysql_tzinfo_to_sql_SOURCES) $(CXXCOMPILE) -c $(INCLUDES) -DTZINFO2SQL $< diff --git a/sql/sp.cc b/sql/sp.cc index f70e150419a..8409f364414 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -481,7 +481,7 @@ db_create_routine(THD *thd, int type, sp_head *sp) { int ret; TABLE *table; - char definer[HOSTNAME_LENGTH+USERNAME_LENGTH+2]; + char definer[USER_HOST_BUFF_SIZE]; char olddb[128]; bool dbchanged; DBUG_ENTER("db_create_routine"); @@ -941,7 +941,7 @@ sp_find_routine(THD *thd, int type, sp_name *name, sp_cache **cp, ulong level; sp_head *new_sp; const char *returns= ""; - char definer[HOSTNAME_LENGTH+USERNAME_LENGTH+2]; + char definer[USER_HOST_BUFF_SIZE]; String retstr(64); DBUG_PRINT("info", ("found: 0x%lx", (ulong)sp)); diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 1d171d929f3..c1f05b0e35c 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -31,6 +31,8 @@ #define SP_STMT_PRINT_MAXLEN 40 +#include <my_user.h> + Item_result sp_map_result_type(enum enum_field_types type) { @@ -1767,29 +1769,21 @@ sp_head::set_info(longlong created, longlong modified, void - sp_head::set_definer(const char *definer, uint definerlen) { - const char *p= strrchr(definer, '@'); + uint user_name_len; + char user_name_str[USERNAME_LENGTH + 1]; + uint host_name_len; + char host_name_str[HOSTNAME_LENGTH + 1]; - if (!p) - { - m_definer_user.str= (char*) ""; - m_definer_user.length= 0; - m_definer_host.str= (char*) ""; - m_definer_host.length= 0; - } - else - { - const uint user_name_len= p - definer; - const uint host_name_len= definerlen - user_name_len - 1; + parse_user(definer, definerlen, user_name_str, &user_name_len, + host_name_str, &host_name_len); - m_definer_user.str= strmake_root(mem_root, definer, user_name_len); - m_definer_user.length= user_name_len; + m_definer_user.str= strmake_root(mem_root, user_name_str, user_name_len); + m_definer_user.length= user_name_len; - m_definer_host.str= strmake_root(mem_root, p + 1, host_name_len); - m_definer_host.length= host_name_len; - } + m_definer_host.str= strmake_root(mem_root, host_name_str, host_name_len); + m_definer_host.length= host_name_len; } diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 1419cd7fc6e..8877d607e92 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2497,7 +2497,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, ulong rights, ulong col_rights, bool revoke_grant) { - char grantor[HOSTNAME_LENGTH+USERNAME_LENGTH+2]; + char grantor[USER_HOST_BUFF_SIZE]; int old_row_exists = 1; int error=0; ulong store_table_rights, store_col_rights; @@ -2615,7 +2615,7 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name, const char *db, const char *routine_name, bool is_proc, ulong rights, bool revoke_grant) { - char grantor[HOSTNAME_LENGTH+USERNAME_LENGTH+2]; + char grantor[USER_HOST_BUFF_SIZE]; int old_row_exists= 1; int error=0; ulong store_proc_rights; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 2f392f46627..76400b5b0fe 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -455,7 +455,12 @@ THD::~THD() /* - Add to one status variable another status variable + Add all status variables to another status variable array + + SYNOPSIS + add_to_status() + to_var add to this array + from_var from this array NOTES This function assumes that all variables are long/ulong. diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 8238496175c..ecde4d01ae1 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -67,7 +67,7 @@ static void decrease_user_connections(USER_CONN *uc); static bool check_db_used(THD *thd,TABLE_LIST *tables); static bool check_multi_update_lock(THD *thd); static void remove_escape(char *name); -static void refresh_status(void); +static void refresh_status(THD *thd); static bool append_file_to_dir(THD *thd, const char **filename_ptr, const char *table_name); @@ -209,7 +209,7 @@ static int get_or_create_user_conn(THD *thd, const char *user, { int return_val= 0; uint temp_len, user_len; - char temp_user[USERNAME_LENGTH+HOSTNAME_LENGTH+2]; + char temp_user[USER_HOST_BUFF_SIZE]; struct user_conn *uc; DBUG_ASSERT(user != 0); @@ -741,7 +741,7 @@ static void reset_mqh(LEX_USER *lu, bool get_them= 0) { USER_CONN *uc; uint temp_len=lu->user.length+lu->host.length+2; - char temp_user[USERNAME_LENGTH+HOSTNAME_LENGTH+2]; + char temp_user[USER_HOST_BUFF_SIZE]; memcpy(temp_user,lu->user.str,lu->user.length); memcpy(temp_user+lu->user.length+1,lu->host.str,lu->host.length); @@ -6625,7 +6625,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables, if (options & REFRESH_HOSTS) hostname_cache_refresh(); if (thd && (options & REFRESH_STATUS)) - refresh_status(); + refresh_status(thd); if (options & REFRESH_THREADS) flush_thread_cache(); #ifdef HAVE_REPLICATION @@ -6713,18 +6713,18 @@ void kill_one_thread(THD *thd, ulong id, bool only_kill_query) /* Clear most status variables */ -static void refresh_status(void) +static void refresh_status(THD *thd) { pthread_mutex_lock(&LOCK_status); - for (SHOW_VAR *ptr= status_vars; ptr->name; ptr++) - if (ptr->type == SHOW_LONG) // note that SHOW_LONG_NOFLUSH variables are not reset - *(ulong*) ptr->value= 0; /* We must update the global status before cleaning up the thread */ - THD *thd= current_thd; add_to_status(&global_status_var, &thd->status_var); bzero((char*) &thd->status_var, sizeof(thd->status_var)); + for (SHOW_VAR *ptr= status_vars; ptr->name; ptr++) + if (ptr->type == SHOW_LONG) // note that SHOW_LONG_NOFLUSH variables are not reset + *(ulong*) ptr->value= 0; + /* Reset the counters of all key caches (default and named). */ process_key_caches(reset_key_cache_counters); pthread_mutex_unlock(&LOCK_status); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 370ec0e77b5..d6b04a9135c 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3038,7 +3038,7 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond) int res= 0; TABLE *table= tables->table; bool full_access; - char definer[HOSTNAME_LENGTH+USERNAME_LENGTH+2]; + char definer[USER_HOST_BUFF_SIZE]; Open_tables_state open_tables_state_backup; DBUG_ENTER("fill_schema_proc"); @@ -3180,7 +3180,7 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables, { CHARSET_INFO *cs= system_charset_info; DBUG_ENTER("get_schema_views_record"); - char definer[HOSTNAME_LENGTH + USERNAME_LENGTH + 2]; + char definer[USER_HOST_BUFF_SIZE]; uint definer_len; if (tables->view) @@ -3364,7 +3364,7 @@ static int get_schema_triggers_record(THD *thd, struct st_table_list *tables, LEX_STRING trigger_name; LEX_STRING trigger_stmt; ulong sql_mode; - char definer_holder[HOSTNAME_LENGTH + USERNAME_LENGTH + 2]; + char definer_holder[USER_HOST_BUFF_SIZE]; LEX_STRING definer_buffer; definer_buffer.str= definer_holder; if (triggers->get_trigger_info(thd, (enum trg_event_type) event, diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index e4b22cffca0..b9da49632d2 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -317,7 +317,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables, LEX_STRING file, trigname_file; LEX_STRING *trg_def, *name; ulonglong *trg_sql_mode; - char trg_definer_holder[HOSTNAME_LENGTH + USERNAME_LENGTH + 2]; + char trg_definer_holder[USER_HOST_BUFF_SIZE]; LEX_STRING *trg_definer; Item_trigger_field *trg_field; struct st_trigname trigname; |