#include "mysql_priv.h"#include "sql_select.h"#include "sql_show.h"#include "repl_failsafe.h"#include "sp.h"#include "sp_head.h"#include "sql_trigger.h"#include "authors.h"#include "contributors.h"#include "events.h"#include "event_timed.h"#include <my_dir.h>Include dependency graph for sql_show.cc:

Go to the source code of this file.
| #define LIST_PROCESS_HOST_LEN 64 |
Definition at line 985 of file sql_show.cc.
Referenced by fill_schema_processlist(), and mysqld_list_processes().
| typedef struct st_index_field_values INDEX_FIELD_VALUES |
Definition at line 37 of file sql_show.cc.
00038 { 00039 ISE_EVENT_CATALOG= 0, 00040 ISE_EVENT_SCHEMA, 00041 ISE_EVENT_NAME, 00042 ISE_DEFINER, 00043 ISE_EVENT_BODY, 00044 ISE_EVENT_DEFINITION, 00045 ISE_EVENT_TYPE, 00046 ISE_EXECUTE_AT, 00047 ISE_INTERVAL_VALUE, 00048 ISE_INTERVAL_FIELD, 00049 ISE_SQL_MODE, 00050 ISE_STARTS, 00051 ISE_ENDS, 00052 ISE_STATUS, 00053 ISE_ON_COMPLETION, 00054 ISE_CREATED, 00055 ISE_LAST_ALTERED, 00056 ISE_LAST_EXECUTED, 00057 ISE_EVENT_COMMENT 00058 };
| enum find_files_result |
Definition at line 477 of file sql_show.cc.
00477 { 00478 FIND_FILES_OK, 00479 FIND_FILES_OOM, 00480 FIND_FILES_DIR 00481 };
| int add_status_vars | ( | SHOW_VAR * | list | ) |
Definition at line 1886 of file sql_show.cc.
References all_status_vars, st_dynamic_array::buffer, st_dynamic_array::elements, err, insert_dynamic(), list(), LOCK_status, my_init_dynamic_array, pthread_mutex_lock, pthread_mutex_unlock, show_var_cmp(), and sort_dynamic.
Referenced by init_common_variables(), and plugin_add().
01887 { 01888 int res= 0; 01889 if (status_vars_inited) 01890 pthread_mutex_lock(&LOCK_status); 01891 if (!all_status_vars.buffer && // array is not allocated yet - do it now 01892 my_init_dynamic_array(&all_status_vars, sizeof(SHOW_VAR), 200, 20)) 01893 { 01894 res= 1; 01895 goto err; 01896 } 01897 while (list->name) 01898 res|= insert_dynamic(&all_status_vars, (gptr)list++); 01899 res|= insert_dynamic(&all_status_vars, (gptr)list); // appending NULL-element 01900 all_status_vars.elements--; // but next insert_dynamic should overwite it 01901 if (status_vars_inited) 01902 sort_dynamic(&all_status_vars, show_var_cmp); 01903 err: 01904 if (status_vars_inited) 01905 pthread_mutex_unlock(&LOCK_status); 01906 return res; 01907 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void append_algorithm | ( | TABLE_LIST * | table, | |
| String * | buff | |||
| ) | [static] |
Definition at line 1469 of file sql_show.cc.
References st_table_list::algorithm, String::append(), DBUG_ASSERT, STRING_WITH_LEN, VIEW_ALGORITHM_MERGE, VIEW_ALGORITHM_TMPTABLE, and VIEW_ALGORITHM_UNDEFINED.
Referenced by get_schema_views_record(), and view_store_options().
01470 { 01471 buff->append(STRING_WITH_LEN("ALGORITHM=")); 01472 switch ((int8)table->algorithm) { 01473 case VIEW_ALGORITHM_UNDEFINED: 01474 buff->append(STRING_WITH_LEN("UNDEFINED ")); 01475 break; 01476 case VIEW_ALGORITHM_TMPTABLE: 01477 buff->append(STRING_WITH_LEN("TEMPTABLE ")); 01478 break; 01479 case VIEW_ALGORITHM_MERGE: 01480 buff->append(STRING_WITH_LEN("MERGE ")); 01481 break; 01482 default: 01483 DBUG_ASSERT(0); // never should happen 01484 } 01485 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void append_definer | ( | THD * | thd, | |
| String * | buffer, | |||
| const LEX_STRING * | definer_user, | |||
| const LEX_STRING * | definer_host | |||
| ) |
Definition at line 1498 of file sql_show.cc.
References append_identifier(), buffer, LEX_STRING::length, LEX_STRING::str, and STRING_WITH_LEN.
Referenced by create_string(), db_create_routine(), mysql_create_or_drop_trigger(), and view_store_options().
01500 { 01501 buffer->append(STRING_WITH_LEN("DEFINER=")); 01502 append_identifier(thd, buffer, definer_user->str, definer_user->length); 01503 buffer->append('@'); 01504 append_identifier(thd, buffer, definer_host->str, definer_host->length); 01505 buffer->append(' '); 01506 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void append_directory | ( | THD * | thd, | |
| String * | packet, | |||
| const char * | dir_type, | |||
| const char * | filename | |||
| ) | [static] |
Definition at line 959 of file sql_show.cc.
References String::append(), dirname_length(), MODE_NO_DIR_IN_CREATE, pos(), and STRING_WITH_LEN.
Referenced by store_create_info().
00961 { 00962 if (filename && !(thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE)) 00963 { 00964 uint length= dirname_length(filename); 00965 packet->append(' '); 00966 packet->append(dir_type); 00967 packet->append(STRING_WITH_LEN(" DIRECTORY='")); 00968 #ifdef __WIN__ 00969 /* Convert \ to / to be able to create table on unix */ 00970 char *winfilename= (char*) thd->memdup(filename, length); 00971 char *pos, *end; 00972 for (pos= winfilename, end= pos+length ; pos < end ; pos++) 00973 { 00974 if (*pos == '\\') 00975 *pos = '/'; 00976 } 00977 filename= winfilename; 00978 #endif 00979 packet->append(filename, length); 00980 packet->append('\''); 00981 } 00982 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 879 of file sql_show.cc.
References String::append(), String::charset(), get_quote_char_for_identifier(), my_mbcharlen, String::reserve(), system_charset_info, and VOID.
Referenced by ha_myisammrg::append_create_info(), append_definer(), Table_triggers_list::change_table_name_in_triggers(), close_temporary_tables(), create_string(), evex_print_warnings(), sp_head::execute_function(), Item_func_sp::func_name(), Event_timed::get_create_event(), mysql_execute_command(), mysql_show_grants(), mysqld_show_create_db(), st_table_list::print(), Item_ref::print(), Item_ident::print(), Item::print_item_w_name(), show_routine_grants(), and store_create_info().
00880 { 00881 const char *name_end; 00882 char quote_char; 00883 int q= get_quote_char_for_identifier(thd, name, length); 00884 00885 if (q == EOF) 00886 { 00887 packet->append(name, length, system_charset_info); 00888 return; 00889 } 00890 00891 /* 00892 The identifier must be quoted as it includes a quote character or 00893 it's a keyword 00894 */ 00895 00896 VOID(packet->reserve(length*2 + 2)); 00897 quote_char= (char) q; 00898 packet->append("e_char, 1, system_charset_info); 00899 00900 for (name_end= name+length ; name < name_end ; name+= length) 00901 { 00902 uchar chr= (uchar) *name; 00903 length= my_mbcharlen(system_charset_info, chr); 00904 /* 00905 my_mbcharlen can retur 0 on a wrong multibyte 00906 sequence. It is possible when upgrading from 4.0, 00907 and identifier contains some accented characters. 00908 The manual says it does not work. So we'll just 00909 change length to 1 not to hang in the endless loop. 00910 */ 00911 if (!length) 00912 length= 1; 00913 if (length == 1 && chr == (uchar) quote_char) 00914 packet->append("e_char, 1, system_charset_info); 00915 packet->append(name, length, packet->charset()); 00916 } 00917 packet->append("e_char, 1, system_charset_info); 00918 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void calc_sum_of_all_status | ( | STATUS_VAR * | to | ) |
Definition at line 2137 of file sql_show.cc.
References add_to_status(), DBUG_ENTER, DBUG_VOID_RETURN, global_status_var, LOCK_thread_count, pthread_mutex_lock, pthread_mutex_unlock, threads, to, and VOID.
Referenced by dispatch_command(), fill_status(), and mysql_print_status().
02138 { 02139 DBUG_ENTER("calc_sum_of_all_status"); 02140 02141 /* Ensure that thread id not killed during loop */ 02142 VOID(pthread_mutex_lock(&LOCK_thread_count)); // For unlink from list 02143 02144 I_List_iterator<THD> it(threads); 02145 THD *tmp; 02146 02147 /* Get global values as base */ 02148 *to= global_status_var; 02149 02150 /* Add to this status from existing threads */ 02151 while ((tmp= it++)) 02152 add_to_status(to, &tmp->status_var); 02153 02154 VOID(pthread_mutex_unlock(&LOCK_thread_count)); 02155 DBUG_VOID_RETURN; 02156 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3873 of file sql_show.cc.
References String::append(), base_list::elements, and String::length().
Referenced by get_schema_partitions_record().
03874 { 03875 List_iterator<char> part_it(field_list); 03876 ulong no_fields= field_list.elements; 03877 const char *field_str; 03878 str->length(0); 03879 while ((field_str= part_it++)) 03880 { 03881 str->append(field_str); 03882 if (--no_fields != 0) 03883 str->append(","); 03884 } 03885 return; 03886 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static int copy_event_to_schema_table | ( | THD * | thd, | |
| TABLE * | sch_table, | |||
| TABLE * | event_table | |||
| ) | [static] |
Definition at line 4221 of file sql_show.cc.
References Event_timed::body, check_access(), Event_timed::comment, Event_timed::created, Event_timed::dbname, DBUG_ASSERT, DBUG_ENTER, DBUG_RETURN, Event_timed::definer, Event_timed::ENABLED, Event_timed::ends, Event_timed::ends_null, ER_CANNOT_LOAD_FROM_TABLE, EVENT_ACL, Event_timed::execute_at, Event_timed::expression, st_table::field, Event_timed::interval, interval_type_to_name, ISE_CREATED, ISE_DEFINER, ISE_ENDS, ISE_EVENT_BODY, ISE_EVENT_COMMENT, ISE_EVENT_DEFINITION, ISE_EVENT_NAME, ISE_EVENT_SCHEMA, ISE_EVENT_TYPE, ISE_EXECUTE_AT, ISE_INTERVAL_FIELD, ISE_INTERVAL_VALUE, ISE_LAST_ALTERED, ISE_LAST_EXECUTED, ISE_ON_COMPLETION, ISE_SQL_MODE, ISE_STARTS, ISE_STATUS, Event_timed::last_executed, LEX_STRING::length, Event_timed::load_from_row(), Event_timed::modified, my_error(), MYF, MYSQL_TIMESTAMP_DATETIME, Event_timed::name, NullS, number_to_datetime(), Event_timed::on_completion, Event_timed::ON_COMPLETION_DROP, Events::reconstruct_interval_expression(), restore_record, schema_table_store_record(), Field::set_notnull(), Event_timed::sql_mode, sql_mode_str, SQLCOM_SHOW_EVENTS, Event_timed::starts, Event_timed::status,