diff options
author | Davi Arnaut <davi.arnaut@oracle.com> | 2010-07-23 17:09:27 -0300 |
---|---|---|
committer | Davi Arnaut <davi.arnaut@oracle.com> | 2010-07-23 17:09:27 -0300 |
commit | 97c3182312568d856e040f8d788f1ee0291717c1 (patch) | |
tree | 541cfc3d5f16c89cdcacdc7babd0c0fdf9de16a0 /sql | |
parent | f31c0483217ba1de24c1e0bfb1c0c8009006cf4d (diff) | |
download | mariadb-git-97c3182312568d856e040f8d788f1ee0291717c1.tar.gz |
WL#5498: Remove dead and unused source code
Remove code that has been disabled for a long time.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.cc | 55 | ||||
-rw-r--r-- | sql/ha_partition.cc | 18 | ||||
-rw-r--r-- | sql/ha_partition.h | 3 | ||||
-rw-r--r-- | sql/handler.cc | 9 | ||||
-rw-r--r-- | sql/nt_servc.cc | 23 | ||||
-rw-r--r-- | sql/protocol.cc | 33 | ||||
-rw-r--r-- | sql/repl_failsafe.cc | 96 | ||||
-rw-r--r-- | sql/slave.cc | 11 | ||||
-rw-r--r-- | sql/sql_class.cc | 65 | ||||
-rw-r--r-- | sql/sql_parse.cc | 22 | ||||
-rw-r--r-- | sql/sql_plugin.cc | 58 | ||||
-rw-r--r-- | sql/sql_select.cc | 59 | ||||
-rw-r--r-- | sql/sql_show.cc | 46 |
13 files changed, 8 insertions, 490 deletions
diff --git a/sql/field.cc b/sql/field.cc index 56d60ff5b28..b62277afa2a 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1277,61 +1277,6 @@ int Field::warn_if_overflow(int op_result) } -#ifdef NOT_USED -static bool test_if_real(const char *str,int length, CHARSET_INFO *cs) -{ - cs= system_charset_info; // QQ move test_if_real into CHARSET_INFO struct - - while (length && my_isspace(cs,*str)) - { // Allow start space - length--; str++; - } - if (!length) - return 0; - if (*str == '+' || *str == '-') - { - length--; str++; - if (!length || !(my_isdigit(cs,*str) || *str == '.')) - return 0; - } - while (length && my_isdigit(cs,*str)) - { - length--; str++; - } - if (!length) - return 1; - if (*str == '.') - { - length--; str++; - while (length && my_isdigit(cs,*str)) - { - length--; str++; - } - } - if (!length) - return 1; - if (*str == 'E' || *str == 'e') - { - if (length < 3 || (str[1] != '+' && str[1] != '-') || - !my_isdigit(cs,str[2])) - return 0; - length-=3; - str+=3; - while (length && my_isdigit(cs,*str)) - { - length--; str++; - } - } - for (; length ; length--, str++) - { // Allow end space - if (!my_isspace(cs,*str)) - return 0; - } - return 1; -} -#endif - - /** Interpret field value as an integer but return the result as a string. diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index bd3cd780bc5..7891f658f45 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -64,10 +64,6 @@ #include "debug_sync.h" static const char *ha_par_ext= ".par"; -#ifdef NOT_USED -static int free_share(PARTITION_SHARE * share); -static PARTITION_SHARE *get_share(const char *table_name, TABLE * table); -#endif /**************************************************************************** MODULE create/delete handler object @@ -1129,13 +1125,6 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, part= i * num_subparts + j; DBUG_PRINT("info", ("Optimize subpartition %u (%s)", part, sub_elem->partition_name)); -#ifdef NOT_USED - if (print_admin_msg(thd, "note", table_share->db.str, table->alias, - opt_op_name[flag], - "Start to operate on subpartition %s", - sub_elem->partition_name)) - DBUG_RETURN(HA_ADMIN_INTERNAL_ERROR); -#endif if ((error= handle_opt_part(thd, check_opt, m_file[part], flag))) { /* print a line which partition the error belongs to */ @@ -1162,13 +1151,6 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, { DBUG_PRINT("info", ("Optimize partition %u (%s)", i, part_elem->partition_name)); -#ifdef NOT_USED - if (print_admin_msg(thd, "note", table_share->db.str, table->alias, - opt_op_name[flag], - "Start to operate on partition %s", - part_elem->partition_name)) - DBUG_RETURN(HA_ADMIN_INTERNAL_ERROR); -#endif if ((error= handle_opt_part(thd, check_opt, m_file[i], flag))) { /* print a line which partition the error belongs to */ diff --git a/sql/ha_partition.h b/sql/ha_partition.h index cdbfb2163c7..cfab2dde394 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -143,9 +143,6 @@ private: Variables for lock structures. */ THR_LOCK_DATA lock; /* MySQL lock */ -#ifdef NOT_USED - PARTITION_SHARE *share; /* Shared lock info */ -#endif /* TRUE <=> this object was created with ha_partition::clone and doesn't diff --git a/sql/handler.cc b/sql/handler.cc index b42840c7b1b..06f869d4dff 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -190,15 +190,6 @@ plugin_ref ha_lock_engine(THD *thd, const handlerton *hton) } -#ifdef NOT_USED -static handler *create_default(TABLE_SHARE *table, MEM_ROOT *mem_root) -{ - handlerton *hton= ha_default_handlerton(current_thd); - return (hton && hton->create) ? hton->create(hton, table, mem_root) : NULL; -} -#endif - - handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type) { plugin_ref plugin; diff --git a/sql/nt_servc.cc b/sql/nt_servc.cc index 76dc2846ed0..1f1b7f0c20f 100644 --- a/sql/nt_servc.cc +++ b/sql/nt_servc.cc @@ -375,29 +375,6 @@ void NTService::ServiceCtrlHandler(DWORD ctrlCode) dwState=pService->dwState; // get current state switch(ctrlCode) { - -#ifdef NOT_USED /* do we need this ? */ - case SERVICE_CONTROL_PAUSE: - if (pService->bRunning && ! pService->bPause) - { - dwState = SERVICE_PAUSED; - pService->SetStatus(SERVICE_PAUSE_PENDING,NO_ERROR, 0, 1, - pService->nPauseTimeOut); - pService->PauseService(); - } - break; - - case SERVICE_CONTROL_CONTINUE: - if (pService->bRunning && pService->bPause) - { - dwState = SERVICE_RUNNING; - pService->SetStatus(SERVICE_CONTINUE_PENDING,NO_ERROR, 0, 1, - pService->nResumeTimeOut); - pService->ResumeService(); - } - break; -#endif - case SERVICE_CONTROL_SHUTDOWN: case SERVICE_CONTROL_STOP: dwState = SERVICE_STOP_PENDING; diff --git a/sql/protocol.cc b/sql/protocol.cc index 3f957dcc2de..87a54eaf10d 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -790,31 +790,14 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags) local_packet->realloc(local_packet->length()+10)) goto err; pos= (char*) local_packet->ptr()+local_packet->length(); - -#ifdef TO_BE_DELETED_IN_6 - if (!(thd->client_capabilities & CLIENT_LONG_FLAG)) - { - pos[0]=3; - int3store(pos+1,field.length); - pos[4]=1; - pos[5]=field.type; - pos[6]=2; - pos[7]= (char) field.flags; - pos[8]= (char) field.decimals; - pos+= 9; - } - else -#endif - { - pos[0]=3; - int3store(pos+1,field.length); - pos[4]=1; - pos[5]=field.type; - pos[6]=3; - int2store(pos+7,field.flags); - pos[9]= (char) field.decimals; - pos+= 10; - } + pos[0]=3; + int3store(pos+1,field.length); + pos[4]=1; + pos[5]=field.type; + pos[6]=3; + int2store(pos+7,field.flags); + pos[9]= (char) field.decimals; + pos+= 10; } local_packet->length((uint) (pos - local_packet->ptr())); if (flags & SEND_DEFAULTS) diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 9a1f7fb826b..18a5303bf96 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -71,42 +71,6 @@ static Slave_log_event* find_slave_event(IO_CACHE* log, functions like register_slave()) are working. */ -#if NOT_USED -static int init_failsafe_rpl_thread(THD* thd) -{ - DBUG_ENTER("init_failsafe_rpl_thread"); - thd->system_thread = SYSTEM_THREAD_DELAYED_INSERT; - /* - thd->bootstrap is to report errors barely to stderr; if this code is - enable again one day, one should check if bootstrap is still needed (maybe - this thread has no other error reporting method). - */ - thd->bootstrap = 1; - thd->security_ctx->skip_grants(); - my_net_init(&thd->net, 0); - thd->net.read_timeout = slave_net_timeout; - thd->max_client_packet_length=thd->net.max_packet; - mysql_mutex_lock(&LOCK_thread_count); - thd->thread_id= thd->variables.pseudo_thread_id= thread_id++; - mysql_mutex_unlock(&LOCK_thread_count); - - if (init_thr_lock() || thd->store_globals()) - { - /* purecov: begin inspected */ - close_connection(thd, ER_OUT_OF_RESOURCES, 1); // is this needed? - statistic_increment(aborted_connects,&LOCK_status); - one_thread_per_connection_end(thd,0); - DBUG_RETURN(-1); - /* purecov: end */ - } - - thd->mem_root->free= thd->mem_root->used= 0; - thd_proc_info(thd, "Thread initialized"); - thd->set_time(); - DBUG_RETURN(0); -} -#endif - void change_rpl_status(RPL_STATUS from_status, RPL_STATUS to_status) { mysql_mutex_lock(&LOCK_rpl_status); @@ -623,66 +587,6 @@ err: } -#if NOT_USED -int find_recovery_captain(THD* thd, MYSQL* mysql) -{ - return 0; -} -#endif - -#if NOT_USED -pthread_handler_t handle_failsafe_rpl(void *arg) -{ - DBUG_ENTER("handle_failsafe_rpl"); - THD *thd = new THD; - thd->thread_stack = (char*)&thd; - MYSQL* recovery_captain = 0; - const char* msg; - - pthread_detach_this_thread(); - if (init_failsafe_rpl_thread(thd) || !(recovery_captain=mysql_init(0))) - { - sql_print_error("Could not initialize failsafe replication thread"); - goto err; - } - mysql_mutex_lock(&LOCK_rpl_status); - msg= thd->enter_cond(&COND_rpl_status, - &LOCK_rpl_status, "Waiting for request"); - while (!thd->killed && !abort_loop) - { - bool break_req_chain = 0; - mysql_cond_wait(&COND_rpl_status, &LOCK_rpl_status); - thd_proc_info(thd, "Processing request"); - while (!break_req_chain) - { - switch (rpl_status) { - case RPL_LOST_SOLDIER: - if (find_recovery_captain(thd, recovery_captain)) - rpl_status=RPL_TROOP_SOLDIER; - else - rpl_status=RPL_RECOVERY_CAPTAIN; - break_req_chain=1; /* for now until other states are implemented */ - break; - default: - break_req_chain=1; - break; - } - } - } - thd->exit_cond(msg); -err: - if (recovery_captain) - mysql_close(recovery_captain); - delete thd; - - DBUG_LEAVE; // Must match DBUG_ENTER() - my_thread_end(); - pthread_exit(0); - return 0; // Avoid compiler warnings -} -#endif - - /** Execute a SHOW SLAVE HOSTS statement. diff --git a/sql/slave.cc b/sql/slave.cc index d41d0479dde..dc0f7286d5c 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -798,17 +798,6 @@ int start_slave_threads(bool need_slave_mutex, bool wait_for_start, } -#ifdef NOT_USED_YET -static int end_slave_on_walk(Master_info* mi, uchar* /*unused*/) -{ - DBUG_ENTER("end_slave_on_walk"); - - end_master_info(mi); - DBUG_RETURN(0); -} -#endif - - /* Release slave threads at time of executing shutdown. diff --git a/sql/sql_class.cc b/sql/sql_class.cc index eb4d353db81..1bec02afa96 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -4171,71 +4171,6 @@ THD::binlog_prepare_pending_rows_event(TABLE*, uint32, MY_BITMAP const*, Update_rows_log_event *); #endif -#ifdef NOT_USED -static char const* -field_type_name(enum_field_types type) -{ - switch (type) { - case MYSQL_TYPE_DECIMAL: - return "MYSQL_TYPE_DECIMAL"; - case MYSQL_TYPE_TINY: - return "MYSQL_TYPE_TINY"; - case MYSQL_TYPE_SHORT: - return "MYSQL_TYPE_SHORT"; - case MYSQL_TYPE_LONG: - return "MYSQL_TYPE_LONG"; - case MYSQL_TYPE_FLOAT: - return "MYSQL_TYPE_FLOAT"; - case MYSQL_TYPE_DOUBLE: - return "MYSQL_TYPE_DOUBLE"; - case MYSQL_TYPE_NULL: - return "MYSQL_TYPE_NULL"; - case MYSQL_TYPE_TIMESTAMP: - return "MYSQL_TYPE_TIMESTAMP"; - case MYSQL_TYPE_LONGLONG: - return "MYSQL_TYPE_LONGLONG"; - case MYSQL_TYPE_INT24: - return "MYSQL_TYPE_INT24"; - case MYSQL_TYPE_DATE: - return "MYSQL_TYPE_DATE"; - case MYSQL_TYPE_TIME: - return "MYSQL_TYPE_TIME"; - case MYSQL_TYPE_DATETIME: - return "MYSQL_TYPE_DATETIME"; - case MYSQL_TYPE_YEAR: - return "MYSQL_TYPE_YEAR"; - case MYSQL_TYPE_NEWDATE: - return "MYSQL_TYPE_NEWDATE"; - case MYSQL_TYPE_VARCHAR: - return "MYSQL_TYPE_VARCHAR"; - case MYSQL_TYPE_BIT: - return "MYSQL_TYPE_BIT"; - case MYSQL_TYPE_NEWDECIMAL: - return "MYSQL_TYPE_NEWDECIMAL"; - case MYSQL_TYPE_ENUM: - return "MYSQL_TYPE_ENUM"; - case MYSQL_TYPE_SET: - return "MYSQL_TYPE_SET"; - case MYSQL_TYPE_TINY_BLOB: - return "MYSQL_TYPE_TINY_BLOB"; - case MYSQL_TYPE_MEDIUM_BLOB: - return "MYSQL_TYPE_MEDIUM_BLOB"; - case MYSQL_TYPE_LONG_BLOB: - return "MYSQL_TYPE_LONG_BLOB"; - case MYSQL_TYPE_BLOB: - return "MYSQL_TYPE_BLOB"; - case MYSQL_TYPE_VAR_STRING: - return "MYSQL_TYPE_VAR_STRING"; - case MYSQL_TYPE_STRING: - return "MYSQL_TYPE_STRING"; - case MYSQL_TYPE_GEOMETRY: - return "MYSQL_TYPE_GEOMETRY"; - } - return "Unknown"; -} -#endif - - /* Declare in unnamed namespace. */ CPP_UNNAMED_NS_START diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 28a867cfcd8..bfae3d9c199 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -7536,28 +7536,6 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables, if (select_lex->item_list.elements) { /* Check permissions for used tables in CREATE TABLE ... SELECT */ - -#ifdef NOT_NECESSARY_TO_CHECK_CREATE_TABLE_EXIST_WHEN_PREPARING_STATEMENT - /* This code throws an ill error for CREATE TABLE t1 SELECT * FROM t1 */ - /* - Only do the check for PS, because we on execute we have to check that - against the opened tables to ensure we don't use a table that is part - of the view (which can only be done after the table has been opened). - */ - if (thd->stmt_arena->is_stmt_prepare_or_first_sp_execute()) - { - /* - For temporary tables we don't have to check if the created table exists - */ - if (!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) && - find_table_in_global_list(tables, create_table->db, - create_table->table_name)) - { - error= FALSE; - goto err; - } - } -#endif if (tables && check_table_access(thd, SELECT_ACL, tables, FALSE, UINT_MAX, FALSE)) goto err; diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 2b6be403fc6..3a0945faa49 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -901,19 +901,6 @@ static void plugin_del(struct st_plugin_int *plugin) DBUG_VOID_RETURN; } -#ifdef NOT_USED - -static void plugin_del(const LEX_STRING *name) -{ - struct st_plugin_int *plugin; - DBUG_ENTER("plugin_del(name)"); - if ((plugin= plugin_find_internal(name, MYSQL_ANY_PLUGIN))) - plugin_del(plugin); - DBUG_VOID_RETURN; -} - -#endif - static void reap_plugins(void) { uint count, idx; @@ -1394,51 +1381,6 @@ static bool register_builtin(struct st_mysql_plugin *plugin, DBUG_RETURN(0); } -#ifdef NOT_USED_YET -/* - Register a plugin at run time. (note, this doesn't initialize a plugin) - Will be useful for embedded applications. - - SYNOPSIS - plugin_register_builtin() - thd current thread (used to store scratch data in mem_root) - plugin static plugin to install - - RETURN - false - plugin registered successfully -*/ -bool plugin_register_builtin(THD *thd, struct st_mysql_plugin *plugin) -{ - struct st_plugin_int tmp, *ptr; - bool result= true; - int dummy_argc= 0; - DBUG_ENTER("plugin_register_builtin"); - - bzero(&tmp, sizeof(tmp)); - tmp.plugin= plugin; - tmp.name.str= (char *)plugin->name; - tmp.name.length= strlen(plugin->name); - - mysql_mutex_lock(&LOCK_plugin); - mysql_rwlock_wrlock(&LOCK_system_variables_hash); - - if (test_plugin_options(thd->mem_root, &tmp, &dummy_argc, NULL)) - goto end; - tmp.state= PLUGIN_IS_UNINITIALIZED; - if ((result= register_builtin(plugin, &tmp, &ptr))) - { - mysql_del_sys_var_chain(tmp.system_vars); - restore_pluginvar_names(tmp.system_vars); - } - -end: - mysql_rwlock_unlock(&LOCK_system_variables_hash); - mysql_mutex_unlock(&LOCK_plugin); - - DBUG_RETURN(result);; -} -#endif /* NOT_USED_YET */ - /* called only by plugin_init() diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 74d05780f81..e18486d718a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -12480,11 +12480,6 @@ join_ft_read_first(JOIN_TAB *tab) if (!table->file->inited) table->file->ha_index_init(tab->ref.key, 1); -#if NOT_USED_YET - /* as ft-key doesn't use store_key's, see also FT_SELECT::init() */ - if (cp_buffer_from_ref(tab->join->thd, table, &tab->ref)) - return -1; -#endif table->file->ft_init(); if ((error= table->file->ft_read(table->record[0]))) @@ -12774,22 +12769,6 @@ end_write(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), { copy_fields(&join->tmp_table_param); copy_funcs(join->tmp_table_param.items_to_copy); -#ifdef TO_BE_DELETED - if (!table->uniques) // If not unique handling - { - /* Copy null values from group to row */ - ORDER *group; - for (group=table->group ; group ; group=group->next) - { - Item *item= *group->item; - if (item->maybe_null) - { - Field *field=item->get_tmp_table_field(); - field->ptr[-1]= (uchar) (field->is_null() ? 1 : 0); - } - } - } -#endif if (!join->having || join->having->val_int()) { int error; @@ -13997,44 +13976,6 @@ err: DBUG_RETURN(-1); } -#ifdef NOT_YET -/** - Add the HAVING criteria to table->select. -*/ - -static bool fix_having(JOIN *join, Item **having) -{ - (*having)->update_used_tables(); // Some tables may have been const - JOIN_TAB *table=&join->join_tab[join->const_tables]; - table_map used_tables= join->const_table_map | table->table->map; - - DBUG_EXECUTE("where",print_where(*having,"having", QT_ORDINARY);); - Item* sort_table_cond=make_cond_for_table(*having,used_tables,used_tables); - if (sort_table_cond) - { - if (!table->select) - if (!(table->select=new SQL_SELECT)) - return 1; - if (!table->select->cond) - table->select->cond=sort_table_cond; - else // This should never happen - if (!(table->select->cond= new Item_cond_and(table->select->cond, - sort_table_cond)) || - table->select->cond->fix_fields(join->thd, &table->select->cond)) - return 1; - table->select_cond=table->select->cond; - table->select_cond->top_level_item(); - DBUG_EXECUTE("where",print_where(table->select_cond, - "select and having", - QT_ORDINARY);); - *having=make_cond_for_table(*having,~ (table_map) 0,~used_tables); - DBUG_EXECUTE("where", - print_where(*having,"having after make_cond", QT_ORDINARY);); - } - return 0; -} -#endif - /***************************************************************************** Remove duplicates from tmp table diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a8ae5832a2a..78508df2c9e 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -5700,52 +5700,6 @@ static int get_schema_partitions_record(THD *thd, TABLE_LIST *tables, } -#ifdef NOT_USED -static interval_type get_real_interval_type(interval_type i_type) -{ - switch (i_type) { - case INTERVAL_YEAR: - return INTERVAL_YEAR; - - case INTERVAL_QUARTER: - case INTERVAL_YEAR_MONTH: - case INTERVAL_MONTH: - return INTERVAL_MONTH; - - case INTERVAL_WEEK: - case INTERVAL_DAY: - return INTERVAL_DAY; - - case INTERVAL_DAY_HOUR: - case INTERVAL_HOUR: - return INTERVAL_HOUR; - - case INTERVAL_DAY_MINUTE: - case INTERVAL_HOUR_MINUTE: - case INTERVAL_MINUTE: - return INTERVAL_MINUTE; - - case INTERVAL_DAY_SECOND: - case INTERVAL_HOUR_SECOND: - case INTERVAL_MINUTE_SECOND: - case INTERVAL_SECOND: - return INTERVAL_SECOND; - - case INTERVAL_DAY_MICROSECOND: - case INTERVAL_HOUR_MICROSECOND: - case INTERVAL_MINUTE_MICROSECOND: - case INTERVAL_SECOND_MICROSECOND: - case INTERVAL_MICROSECOND: - return INTERVAL_MICROSECOND; - case INTERVAL_LAST: - DBUG_ASSERT(0); - } - DBUG_ASSERT(0); - return INTERVAL_SECOND; -} - -#endif - #ifdef HAVE_EVENT_SCHEDULER /* Loads an event from mysql.event and copies it's data to a row of |