diff options
author | Mats Kindahl <mats.kindahl@oracle.com> | 2010-08-23 15:32:39 +0200 |
---|---|---|
committer | Mats Kindahl <mats.kindahl@oracle.com> | 2010-08-23 15:32:39 +0200 |
commit | b7ed981f3793b4464b99c98b7baa3c511b52b6a5 (patch) | |
tree | c911bc462dcc01e53c97da9113effe39c75fc499 /sql | |
parent | f57888054936dad42dc75376c87e39d9539f8240 (diff) | |
parent | 8c4d4cc3a6f1fd9852e11e16926a5e98cca5ee03 (diff) | |
download | mariadb-git-b7ed981f3793b4464b99c98b7baa3c511b52b6a5.tar.gz |
Merging with mysql-5.5
Diffstat (limited to 'sql')
-rw-r--r-- | sql/events.cc | 2 | ||||
-rw-r--r-- | sql/events.h | 2 | ||||
-rw-r--r-- | sql/item.h | 1 | ||||
-rw-r--r-- | sql/item_buff.cc | 6 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 2 | ||||
-rw-r--r-- | sql/mysqld.cc | 8 | ||||
-rw-r--r-- | sql/mysqld.h | 6 | ||||
-rw-r--r-- | sql/sql_class.cc | 4 | ||||
-rw-r--r-- | sql/sql_class.h | 12 | ||||
-rw-r--r-- | sql/sql_insert.cc | 3 | ||||
-rw-r--r-- | sql/sql_lex.cc | 3 | ||||
-rw-r--r-- | sql/sql_load.cc | 8 | ||||
-rw-r--r-- | sql/sql_plugin.cc | 8 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 4 | ||||
-rw-r--r-- | sql/sql_select.cc | 2 | ||||
-rw-r--r-- | sql/sql_update.cc | 70 | ||||
-rw-r--r-- | sql/sys_vars.h | 14 |
17 files changed, 50 insertions, 105 deletions
diff --git a/sql/events.cc b/sql/events.cc index 5379ec2c9eb..99304a1c460 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -76,7 +76,7 @@ Event_queue *Events::event_queue; Event_scheduler *Events::scheduler; Event_db_repository *Events::db_repository; -uint Events::opt_event_scheduler= Events::EVENTS_OFF; +ulong Events::opt_event_scheduler= Events::EVENTS_OFF; mysql_mutex_t Events::LOCK_event_metadata; bool Events::check_system_tables_error= FALSE; diff --git a/sql/events.h b/sql/events.h index c84c37b881d..1482e736d29 100644 --- a/sql/events.h +++ b/sql/events.h @@ -91,7 +91,7 @@ public: */ enum enum_opt_event_scheduler { EVENTS_OFF, EVENTS_ON, EVENTS_DISABLED }; /* Protected using LOCK_global_system_variables only. */ - static uint opt_event_scheduler; + static ulong opt_event_scheduler; static mysql_mutex_t LOCK_event_metadata; static bool check_if_system_tables_error(); static bool start(); diff --git a/sql/item.h b/sql/item.h index c7a97ca716a..7f148a0a3e6 100644 --- a/sql/item.h +++ b/sql/item.h @@ -2982,6 +2982,7 @@ public: class Cached_item_str :public Cached_item { Item *item; + uint32 value_max_length; String value,tmp_value; public: Cached_item_str(THD *thd, Item *arg); diff --git a/sql/item_buff.cc b/sql/item_buff.cc index a1bbd95c2c6..87197c7d9b6 100644 --- a/sql/item_buff.cc +++ b/sql/item_buff.cc @@ -65,7 +65,9 @@ Cached_item::~Cached_item() {} */ Cached_item_str::Cached_item_str(THD *thd, Item *arg) - :item(arg), value(min(arg->max_length, thd->variables.max_sort_length)) + :item(arg), + value_max_length(min(arg->max_length, thd->variables.max_sort_length)), + value(value_max_length) {} bool Cached_item_str::cmp(void) @@ -74,7 +76,7 @@ bool Cached_item_str::cmp(void) bool tmp; if ((res=item->val_str(&tmp_value))) - res->length(min(res->length(), value.alloced_length())); + res->length(min(res->length(), value_max_length)); if (null_value != item->null_value) { if ((null_value= item->null_value)) diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 85565b735d4..c18b79371df 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -4617,7 +4617,7 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref) return TRUE; } - if (escape_item->const_item()) + if (escape_item->const_item() && !thd->lex->view_prepare_mode) { /* If we are on execution stage */ String *escape_str= escape_item->val_str(&cmp.value1); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 825085b5f0b..880d700abeb 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -441,10 +441,10 @@ static bool calling_initgroups= FALSE; /**< Used in SIGSEGV handler. */ #endif uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options; uint mysqld_port_timeout; -uint delay_key_write_options; +ulong delay_key_write_options; uint protocol_version; uint lower_case_table_names; -uint tc_heuristic_recover= 0; +ulong tc_heuristic_recover= 0; uint volatile thread_count; int32 thread_running; ulong thread_created; @@ -455,7 +455,7 @@ ulong slow_launch_time, slave_open_temp_tables; ulong open_files_limit, max_binlog_size, max_relay_log_size; ulong slave_trans_retries; uint slave_net_timeout; -uint slave_exec_mode_options; +ulong slave_exec_mode_options; ulonglong slave_type_conversions_options; ulong thread_cache_size=0; ulong binlog_cache_size=0; @@ -554,7 +554,7 @@ char *mysql_data_home= const_cast<char*>("."); const char *mysql_real_data_home_ptr= mysql_real_data_home; char server_version[SERVER_VERSION_LENGTH]; char *mysqld_unix_port, *opt_mysql_tmpdir; -uint thread_handling; +ulong thread_handling; /** name of reference on left expression in rewritten IN subquery */ const char *in_left_expr_name= "<left expr>"; diff --git a/sql/mysqld.h b/sql/mysqld.h index 6135fcead8b..5350602d435 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -105,7 +105,7 @@ extern uint connection_count; extern my_bool opt_safe_user_create; extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap; extern my_bool opt_slave_compressed_protocol, use_temp_pool; -extern uint slave_exec_mode_options; +extern ulong slave_exec_mode_options; extern ulonglong slave_type_conversions_options; extern my_bool opt_readonly, lower_case_file_system; extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs; @@ -136,7 +136,7 @@ extern my_bool relay_log_purge, opt_innodb_safe_binlog, opt_innodb; extern my_bool relay_log_recovery; extern uint test_flags,select_errors,ha_open_options; extern uint protocol_version, mysqld_port, dropping_tables; -extern uint delay_key_write_options; +extern ulong delay_key_write_options; extern char *opt_logname, *opt_slow_logname; extern char *opt_backup_history_logname, *opt_backup_progress_logname, *opt_backup_settings_name; @@ -300,7 +300,7 @@ extern ulong specialflag; extern uint mysql_data_home_len; extern uint mysql_real_data_home_len; extern const char *mysql_real_data_home_ptr; -extern uint thread_handling; +extern ulong thread_handling; extern MYSQL_PLUGIN_IMPORT char *mysql_data_home; extern char server_version[SERVER_VERSION_LENGTH]; extern MYSQL_PLUGIN_IMPORT char mysql_real_data_home[]; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index d097f7b32a8..626173fedce 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -3710,7 +3710,7 @@ int THD::decide_logging_format(TABLE_LIST *tables) { DBUG_ENTER("THD::decide_logging_format"); DBUG_PRINT("info", ("query: %s", query())); - DBUG_PRINT("info", ("variables.binlog_format: %u", + DBUG_PRINT("info", ("variables.binlog_format: %lu", variables.binlog_format)); DBUG_PRINT("info", ("lex->get_stmt_unsafe_flags(): 0x%x", lex->get_stmt_unsafe_flags())); @@ -4083,7 +4083,7 @@ int THD::decide_logging_format(TABLE_LIST *tables) DBUG_PRINT("info", ("decision: no logging since " "mysql_bin_log.is_open() = %d " "and (options & OPTION_BIN_LOG) = 0x%llx " - "and binlog_format = %u " + "and binlog_format = %lu " "and binlog_filter->db_ok(db) = %d", mysql_bin_log.is_open(), (variables.option_bits & OPTION_BIN_LOG), diff --git a/sql/sql_class.h b/sql/sql_class.h index 88e3f6aa52e..c9d62c1fa01 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -114,7 +114,7 @@ extern bool volatile shutdown_in_progress; #define TC_HEURISTIC_RECOVER_COMMIT 1 #define TC_HEURISTIC_RECOVER_ROLLBACK 2 -extern uint tc_heuristic_recover; +extern ulong tc_heuristic_recover; typedef struct st_user_var_events { @@ -426,13 +426,13 @@ typedef struct system_variables ulong log_warnings; ulong group_concat_max_len; - uint binlog_format; ///< binlog format for this thd (see enum_binlog_format) + ulong binlog_format; ///< binlog format for this thd (see enum_binlog_format) my_bool binlog_direct_non_trans_update; my_bool sql_log_bin; - uint completion_type; - uint query_cache_type; - uint tx_isolation; - uint updatable_views_with_limit; + ulong completion_type; + ulong query_cache_type; + ulong tx_isolation; + ulong updatable_views_with_limit; uint max_user_connections; /** In slave thread we need to know in behalf of which diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index a0d347f48de..326a5defa9b 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -3043,6 +3043,9 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u) we are fixing fields from insert list. */ lex->current_select= &lex->select_lex; + + /* Errors during check_insert_fields() should not be ignored. */ + lex->current_select->no_error= FALSE; res= (setup_fields(thd, 0, values, MARK_COLUMNS_READ, 0, 0) || check_insert_fields(thd, table_list, *fields, values, !insert_into_view, 1, &map)); diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index b70f33a6c3f..1d288f3de20 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1438,8 +1438,6 @@ int lex_one_token(void *arg, void *yythd) } else { - const char* version_mark= lip->get_ptr() - 1; - DBUG_ASSERT(*version_mark == '!'); /* Patch and skip the conditional comment to avoid it being propagated infinitely (eg. to a slave). @@ -1448,7 +1446,6 @@ int lex_one_token(void *arg, void *yythd) comment_closed= ! consume_comment(lip, 1); if (! comment_closed) { - DBUG_ASSERT(pcom == version_mark); *pcom= '!'; } /* version allowed to have one level of comment inside. */ diff --git a/sql/sql_load.cc b/sql/sql_load.cc index d367c1c4fde..15efa488173 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -189,6 +189,14 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, bool is_concurrent; DBUG_ENTER("mysql_load"); + /* + Bug #34283 + mysqlbinlog leaves tmpfile after termination if binlog contains + load data infile, so in mixed mode we go to row-based for + avoiding the problem. + */ + thd->set_current_stmt_binlog_format_row_if_mixed(); + #ifdef EMBEDDED_LIBRARY read_file_from_client = 0; //server is always in the same process #endif diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 7e8c1fed999..e3323260373 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -3025,11 +3025,11 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp, Allocate temporary space for the value of the tristate. This option will have a limited lifetime and is not used beyond server initialization. - GET_ENUM value is an unsigned integer. + GET_ENUM value is an unsigned long integer. */ options[0].value= options[1].value= - (uchar **)alloc_root(mem_root, sizeof(uint)); - *((uint*) options[0].value)= (uint) options[0].def_value; + (uchar **)alloc_root(mem_root, sizeof(ulong)); + *((ulong*) options[0].value)= (ulong) options[0].def_value; options+= 2; } @@ -3328,7 +3328,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, list is always the <plugin name> option value. */ if (!tmp->is_mandatory) - plugin_load_policy= (enum_plugin_load_policy)*(uint*)opts[0].value; + plugin_load_policy= (enum_plugin_load_policy)*(ulong*)opts[0].value; } disable_plugin= (plugin_load_policy == PLUGIN_OFF); diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index a77dbe2dab4..39cebfbe048 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -883,7 +883,7 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array, type (the types are supplied at execute). Check that the supplied type of placeholder can accept a data stream. */ - else if (!is_param_long_data_type(param)) + else if (! is_param_long_data_type(param)) DBUG_RETURN(1); res= param->query_val_str(&str); if (param->convert_str_value(thd)) @@ -929,7 +929,7 @@ static bool insert_params(Prepared_statement *stmt, uchar *null_array, type (the types are supplied at execute). Check that the supplied type of placeholder can accept a data stream. */ - else if (is_param_long_data_type(param)) + else if (! is_param_long_data_type(param)) DBUG_RETURN(1); if (param->convert_str_value(stmt->thd)) DBUG_RETURN(1); /* out of memory */ diff --git a/sql/sql_select.cc b/sql/sql_select.cc index ccfd93a1bc8..3c9eb215641 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -6914,6 +6914,8 @@ bool error_if_full_join(JOIN *join) { if (tab->type == JT_ALL && (!tab->select || !tab->select->quick)) { + /* This error should not be ignored. */ + join->select_lex->no_error= FALSE; my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE, ER(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0)); return(1); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 35478e28520..68440f6623a 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1145,57 +1145,6 @@ int mysql_multi_update_prepare(THD *thd) } -/** - Implementation of the safe update options during UPDATE IGNORE. This syntax - causes an UPDATE statement to ignore all errors. In safe update mode, - however, we must never ignore the ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE. There - is a special hook in my_message_sql that will otherwise delete all errors - when the IGNORE option is specified. - - In the future, all IGNORE handling should be used with this class and all - traces of the hack outlined below should be removed. - - - The parser detects IGNORE option and sets thd->lex->ignore= 1 - - - In JOIN::optimize, if this is set, then - thd->lex->current_select->no_error gets set. - - - In my_message_sql(), if the flag above is set then any error is - unconditionally converted to a warning. - - We are moving in the direction of using Internal_error_handler subclasses - to do all such error tweaking, please continue this effort if new bugs - appear. - */ -class Safe_dml_handler : public Internal_error_handler { - -private: - bool m_handled_error; - -public: - explicit Safe_dml_handler() : m_handled_error(FALSE) {} - - bool handle_condition(THD *thd, - uint sql_errno, - const char* sqlstate, - MYSQL_ERROR::enum_warning_level level, - const char* msg, - MYSQL_ERROR ** cond_hdl) - { - if (level == MYSQL_ERROR::WARN_LEVEL_ERROR && - sql_errno == ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE) - { - thd->stmt_da->set_error_status(thd, sql_errno, msg, sqlstate); - m_handled_error= TRUE; - return TRUE; - } - return FALSE; - } - - bool handled_error() { return m_handled_error; } - -}; - /* Setup multi-update handling and call SELECT to do the join */ @@ -1229,11 +1178,6 @@ bool mysql_multi_update(THD *thd, List<Item> total_list; - Safe_dml_handler handler; - bool using_handler= thd->variables.option_bits & OPTION_SAFE_UPDATES; - if (using_handler) - thd->push_internal_handler(&handler); - res= mysql_select(thd, &select_lex->ref_pointer_array, table_list, select_lex->with_wild, total_list, @@ -1243,21 +1187,9 @@ bool mysql_multi_update(THD *thd, OPTION_SETUP_TABLES_DONE, *result, unit, select_lex); - if (using_handler) - { - Internal_error_handler *top_handler; - top_handler= thd->pop_internal_handler(); - DBUG_ASSERT(&handler == top_handler); - } - DBUG_PRINT("info",("res: %d report_error: %d", res, (int) thd->is_error())); res|= thd->is_error(); - /* - Todo: remove below code and make Safe_dml_handler do error processing - instead. That way we can return the actual error instead of - ER_UNKNOWN_ERROR. - */ - if (unlikely(res) && (!using_handler || !handler.handled_error())) + if (unlikely(res)) { /* If we had a another error reported earlier then this will be ignored */ (*result)->send_error(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR)); diff --git a/sql/sys_vars.h b/sql/sys_vars.h index ca3fc99deba..ee6b429b04a 100644 --- a/sql/sys_vars.h +++ b/sql/sys_vars.h @@ -271,28 +271,28 @@ public: deprecated_version, substitute) { option.var_type= GET_ENUM; - global_var(uint)= def_val; + global_var(ulong)= def_val; DBUG_ASSERT(def_val < typelib.count); - DBUG_ASSERT(size == sizeof(uint)); + DBUG_ASSERT(size == sizeof(ulong)); } bool session_update(THD *thd, set_var *var) { - session_var(thd, uint)= var->save_result.ulonglong_value; + session_var(thd, ulong)= var->save_result.ulonglong_value; return false; } bool global_update(THD *thd, set_var *var) { - global_var(uint)= var->save_result.ulonglong_value; + global_var(ulong)= var->save_result.ulonglong_value; return false; } void session_save_default(THD *thd, set_var *var) - { var->save_result.ulonglong_value= global_var(uint); } + { var->save_result.ulonglong_value= global_var(ulong); } void global_save_default(THD *thd, set_var *var) { var->save_result.ulonglong_value= option.def_value; } uchar *session_value_ptr(THD *thd, LEX_STRING *base) - { return (uchar*)typelib.type_names[session_var(thd, uint)]; } + { return (uchar*)typelib.type_names[session_var(thd, ulong)]; } uchar *global_value_ptr(THD *thd, LEX_STRING *base) - { return (uchar*)typelib.type_names[global_var(uint)]; } + { return (uchar*)typelib.type_names[global_var(ulong)]; } }; /** |