From: Alexander Barkov Date: May 16 2012 6:43am Subject: bzr push into mysql-trunk branch (alexander.barkov:3845 to 3846) List-Archive: http://lists.mysql.com/commits/143810 Message-Id: <201205160649.q4G6nnd7032038@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3846 Alexander Barkov 2012-05-16 Fixing naming convension: SimpleCString -> Simple_cstring NameString -> Name_string ItemNameString -> Item_name_string modified: sql/item.cc sql/item.h sql/item_func.cc sql/item_func.h sql/item_strfunc.h sql/item_xmlfunc.cc sql/log_event.cc sql/sql_show.cc sql/sql_show.h sql/sql_string.h 3845 Nuno Carvalho 2012-05-15 [merge] BUG#11754117 - 45670: INTVAR_EVENTS FOR FILTERED-OUT QUERY_LOG_EVENTS ARE EXECUTED Automerge from mysql-5.5 into mysql-trunk. modified: mysql-test/suite/rpl/r/rpl_filter_tables_not_exist.result mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test === modified file 'sql/item.cc' --- a/sql/item.cc 2012-05-09 16:47:39 +0000 +++ b/sql/item.cc 2012-05-16 06:42:17 +0000 @@ -959,10 +959,10 @@ bool Item::check_cols(uint c) } -const NameString null_name_string(NULL, 0); +const Name_string null_name_string(NULL, 0); -void NameString::copy(const char *str, size_t length, const CHARSET_INFO *cs) +void Name_string::copy(const char *str, size_t length, const CHARSET_INFO *cs) { if (!length) { @@ -998,9 +998,9 @@ void NameString::copy(const char *str, s } -void ItemNameString::copy(const char *str_arg, size_t length_arg, - const CHARSET_INFO *cs_arg, - bool is_autogenerated_arg) +void Item_name_string::copy(const char *str_arg, size_t length_arg, + const CHARSET_INFO *cs_arg, + bool is_autogenerated_arg) { m_is_autogenerated= is_autogenerated_arg; copy(str_arg, length_arg, cs_arg); @@ -1509,7 +1509,7 @@ bool Item::is_blob_field() const Item_sp_variable methods *****************************************************************************/ -Item_sp_variable::Item_sp_variable(const NameString sp_var_name) +Item_sp_variable::Item_sp_variable(const Name_string sp_var_name) :m_thd(0), m_name(sp_var_name) #ifndef DBUG_OFF , m_sp(0) @@ -1629,7 +1629,7 @@ bool Item_sp_variable::is_null() Item_splocal methods *****************************************************************************/ -Item_splocal::Item_splocal(const NameString sp_var_name, +Item_splocal::Item_splocal(const Name_string sp_var_name, uint sp_var_idx, enum_field_types sp_var_type, uint pos_in_q, uint len_in_q) @@ -1693,7 +1693,7 @@ bool Item_splocal::set_value(THD *thd, s *****************************************************************************/ Item_case_expr::Item_case_expr(uint case_expr_id) - :Item_sp_variable(NameString(C_STRING_WITH_LEN("case_expr"))), + :Item_sp_variable(Name_string(C_STRING_WITH_LEN("case_expr"))), m_case_expr_id(case_expr_id) { } @@ -3052,7 +3052,7 @@ Item_decimal::Item_decimal(double val, i } -Item_decimal::Item_decimal(const NameString &name_arg, +Item_decimal::Item_decimal(const Name_string &name_arg, const my_decimal *val_arg, uint decimal_par, uint length) { === modified file 'sql/item.h' --- a/sql/item.h 2012-05-07 08:29:18 +0000 +++ b/sql/item.h 2012-05-16 06:42:17 +0000 @@ -146,14 +146,14 @@ public: /** Storage for name strings. - Enpowers SimpleCString with allocation routines from the sql_strmake family. + Enpowers Simple_cstring with allocation routines from the sql_strmake family. This class must stay as small as possible as we often pass it into functions using call-by-value evaluation. Don't add new members or virual methods into this class! */ -class NameString: public SimpleCString +class Name_string: public Simple_cstring { private: void set_or_copy(const char *str, size_t length, bool is_null_terminated) @@ -164,22 +164,22 @@ private: copy(str, length); } public: - NameString(): SimpleCString() {} + Name_string(): Simple_cstring() {} /* - Please do NOT add constructor NameString(const char *str) ! + Please do NOT add constructor Name_string(const char *str) ! It will involve hidden strlen() call, which can affect - performance negatively. Use NameString(str, len) instead. + performance negatively. Use Name_string(str, len) instead. */ - NameString(const char *str, size_t length): - SimpleCString(str, length) {} - NameString(const LEX_STRING str): SimpleCString(str) {} - NameString(const char *str, size_t length, bool is_null_terminated): - SimpleCString() + Name_string(const char *str, size_t length): + Simple_cstring(str, length) {} + Name_string(const LEX_STRING str): Simple_cstring(str) {} + Name_string(const char *str, size_t length, bool is_null_terminated): + Simple_cstring() { set_or_copy(str, length, is_null_terminated); } - NameString(const LEX_STRING str, bool is_null_terminated): - SimpleCString() + Name_string(const LEX_STRING str, bool is_null_terminated): + Simple_cstring() { set_or_copy(str.str, str.length, is_null_terminated); } @@ -206,7 +206,7 @@ public: { copy(lex->str, lex->length); } - void copy(const NameString str) + void copy(const Name_string str) { copy(str.ptr(), str.length()); } @@ -223,39 +223,39 @@ public: return is_set() && str && eq(str); } /** - Compare name to another name in NameString, case insensitively. + Compare name to another name in Name_string, case insensitively. */ - bool eq(const NameString name) const + bool eq(const Name_string name) const { return eq(name.ptr()); } - bool eq_safe(const NameString name) const + bool eq_safe(const Name_string name) const { return is_set() && name.is_set() && eq(name); } }; -#define NAME_STRING(x) NameString(C_STRING_WITH_LEN(x)) +#define NAME_STRING(x) Name_string(C_STRING_WITH_LEN(x)) -extern const NameString null_name_string; +extern const Name_string null_name_string; /** Storage for Item names. - Adds "autogenerated" flag and warning functionality to NameString. + Adds "autogenerated" flag and warning functionality to Name_string. */ -class ItemNameString: public NameString +class Item_name_string: public Name_string { private: bool m_is_autogenerated; /* indicates if name of this Item was autogenerated or set by user */ public: - ItemNameString(): NameString(), m_is_autogenerated(true) + Item_name_string(): Name_string(), m_is_autogenerated(true) { } - ItemNameString(const NameString name) - :NameString(name), m_is_autogenerated(true) + Item_name_string(const Name_string name) + :Name_string(name), m_is_autogenerated(true) { } /** Set m_is_autogenerated flag to the given value. @@ -268,7 +268,7 @@ public: Return the auto-generated flag. */ bool is_autogenerated() const { return m_is_autogenerated; } - using NameString::copy; + using Name_string::copy; /** Copy name together with autogenerated flag. Produce a warning if name was cut. @@ -680,8 +680,8 @@ public: */ String str_value; - ItemNameString item_name; /* Name from select */ - ItemNameString orig_name; /* Original item name (if it was renamed)*/ + Item_name_string item_name; /* Name from select */ + Item_name_string orig_name; /* Original item name (if it was renamed)*/ /** Intrusive list pointer for free list. If not null, points to the next @@ -1713,7 +1713,7 @@ protected: THD *m_thd; public: - NameString m_name; + Name_string m_name; public: #ifndef DBUG_OFF @@ -1725,7 +1725,7 @@ public: #endif public: - Item_sp_variable(const NameString sp_var_name); + Item_sp_variable(const Name_string sp_var_name); public: bool fix_fields(THD *thd, Item **); @@ -1809,7 +1809,7 @@ public: */ uint len_in_query; - Item_splocal(const NameString sp_var_name, uint sp_var_idx, + Item_splocal(const Name_string sp_var_name, uint sp_var_idx, enum_field_types sp_var_type, uint pos_in_q= 0, uint len_in_q= 0); @@ -2265,7 +2265,7 @@ public: init(); item_name= NAME_STRING("NULL"); } - Item_null(const NameString &name_par) + Item_null(const Name_string &name_par) { init(); item_name= name_par; @@ -2500,7 +2500,7 @@ public: max_length= item_arg->max_length; fixed= 1; } - Item_int(const NameString &name_arg, longlong i, uint length) :value(i) + Item_int(const Name_string &name_arg, longlong i, uint length) :value(i) { max_length= length; item_name= name_arg; @@ -2563,7 +2563,7 @@ public: { DBUG_ASSERT(is_temporal_type(field_type_arg)); } - Item_temporal(enum_field_types field_type_arg, const NameString &name_arg, + Item_temporal(enum_field_types field_type_arg, const Name_string &name_arg, longlong i, uint length): Item_int(i), cached_field_type(field_type_arg) { @@ -2599,7 +2599,7 @@ public: Item_uint(const char *str_arg, uint length) :Item_int(str_arg, length) { unsigned_flag= 1; } Item_uint(ulonglong i) :Item_int((ulonglong) i, 10) {} - Item_uint(const NameString &name_arg, longlong i, uint length) + Item_uint(const Name_string &name_arg, longlong i, uint length) :Item_int(name_arg, i, length) { unsigned_flag= 1; } double val_real() { DBUG_ASSERT(fixed == 1); return ulonglong2double((ulonglong)value); } @@ -2621,7 +2621,7 @@ protected: my_decimal decimal_value; public: Item_decimal(const char *str_arg, uint length, const CHARSET_INFO *charset); - Item_decimal(const NameString &name_arg, + Item_decimal(const Name_string &name_arg, const my_decimal *val_arg, uint decimal_par, uint length); Item_decimal(my_decimal *value_par); Item_decimal(longlong val, bool unsig); @@ -2665,12 +2665,12 @@ public: class Item_float :public Item_num { - NameString presentation; + Name_string presentation; public: double value; // Item_real() :value(0) {} Item_float(const char *str_arg, uint length); - Item_float(const NameString name_arg, + Item_float(const Name_string name_arg, double val_arg, uint decimal_par, uint length) :value(val_arg) { @@ -2723,9 +2723,9 @@ public: class Item_static_float_func :public Item_float { - const NameString func_name; + const Name_string func_name; public: - Item_static_float_func(const NameString &name_arg, + Item_static_float_func(const Name_string &name_arg, double val_arg, uint decimal_par, uint length) :Item_float(null_name_string, val_arg, decimal_par, length), func_name(name_arg) @@ -2774,7 +2774,7 @@ public: fixed= 1; } /* Create from the given name and string. */ - Item_string(const NameString name_par, const char *str, uint length, + Item_string(const Name_string name_par, const char *str, uint length, const CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE, uint repertoire= MY_REPERTOIRE_UNICODE30) : m_cs_specified(FALSE) @@ -2826,7 +2826,7 @@ public: bool eq(const Item *item, bool binary_cmp) const; Item *clone_item() { - return new Item_string(static_cast(item_name), str_value.ptr(), + return new Item_string(static_cast(item_name), str_value.ptr(), str_value.length(), collation.collation); } Item *safe_charset_converter(const CHARSET_INFO *tocs); @@ -2892,9 +2892,9 @@ double_from_string_with_check (const CHA class Item_static_string_func :public Item_string { - const NameString func_name; + const Name_string func_name; public: - Item_static_string_func(const NameString &name_par, + Item_static_string_func(const Name_string &name_par, const char *str, uint length, const CHARSET_INFO *cs, Derivation dv= DERIVATION_COERCIBLE) :Item_string(null_name_string, str, length, cs, dv), func_name(name_par) @@ -2914,7 +2914,7 @@ public: class Item_partition_func_safe_string: public Item_string { public: - Item_partition_func_safe_string(const NameString name, uint length, + Item_partition_func_safe_string(const Name_string name, uint length, const CHARSET_INFO *cs= NULL): Item_string(name, NullS, 0, cs) { @@ -2928,7 +2928,7 @@ class Item_return_date_time :public Item enum_field_types date_time_field_type; public: Item_return_date_time(const char *name_arg, enum_field_types field_type_arg) - :Item_partition_func_safe_string(NameString(name_arg, strlen(name_arg)), + :Item_partition_func_safe_string(Name_string(name_arg, strlen(name_arg)), 0, &my_charset_bin), date_time_field_type(field_type_arg) { decimals= 0; } @@ -2940,7 +2940,7 @@ class Item_blob :public Item_partition_f { public: Item_blob(const char *name, uint length) : - Item_partition_func_safe_string(NameString(name, strlen(name)), + Item_partition_func_safe_string(Name_string(name, strlen(name)), length, &my_charset_bin) { } enum Type type() const { return TYPE_HOLDER; } @@ -2959,7 +2959,7 @@ class Item_empty_string :public Item_par public: Item_empty_string(const char *header, uint length, const CHARSET_INFO *cs= NULL) : - Item_partition_func_safe_string(NameString(header, strlen(header)), + Item_partition_func_safe_string(Name_string(header, strlen(header)), 0, cs ? cs : &my_charset_utf8_general_ci) { max_length= length * collation.collation->mbmaxlen; @@ -2974,7 +2974,7 @@ class Item_return_int :public Item_int public: Item_return_int(const char *name_arg, uint length, enum_field_types field_type_arg, longlong value= 0) - :Item_int(NameString(name_arg, name_arg ? strlen(name_arg) : 0), + :Item_int(Name_string(name_arg, name_arg ? strlen(name_arg) : 0), value, length), int_field_type(field_type_arg) { unsigned_flag=1; === modified file 'sql/item_func.cc' --- a/sql/item_func.cc 2012-05-07 08:29:18 +0000 +++ b/sql/item_func.cc 2012-05-16 06:42:17 +0000 @@ -4546,7 +4546,7 @@ longlong Item_func_sleep::val_int() #define extra_size sizeof(double) -static user_var_entry *get_variable(HASH *hash, NameString &name, +static user_var_entry *get_variable(HASH *hash, Name_string &name, bool create_if_not_exists) { user_var_entry *entry; @@ -5363,7 +5363,7 @@ longlong Item_func_get_user_var::val_int static int get_var_with_binlog(THD *thd, enum_sql_command sql_command, - NameString &name, user_var_entry **out_entry) + Name_string &name, user_var_entry **out_entry) { BINLOG_USER_VAR_EVENT *user_var_event; user_var_entry *var_entry; === modified file 'sql/item_func.h' --- a/sql/item_func.h 2012-05-07 08:29:18 +0000 +++ b/sql/item_func.h 2012-05-16 06:42:17 +0000 @@ -1638,8 +1638,8 @@ class Item_func_set_user_var :public Ite } save_result; public: - NameString name; // keep it public - Item_func_set_user_var(NameString a, Item *b) + Name_string name; // keep it public + Item_func_set_user_var(Name_string a, Item *b) :Item_var_func(b), cached_result_type(INT_RESULT), entry(NULL), entry_thread_id(0), name(a) {} @@ -1693,8 +1693,8 @@ class Item_func_get_user_var :public Ite Item_result m_cached_result_type; public: - NameString name; // keep it public - Item_func_get_user_var(NameString a): + Name_string name; // keep it public + Item_func_get_user_var(Name_string a): Item_var_func(), m_cached_result_type(STRING_RESULT), name(a) {} enum Functype functype() const { return GUSERVAR_FUNC; } double val_real(); @@ -1735,10 +1735,10 @@ public: */ class Item_user_var_as_out_param :public Item { - NameString name; + Name_string name; user_var_entry *entry; public: - Item_user_var_as_out_param(NameString a) :name(a) + Item_user_var_as_out_param(Name_string a) :name(a) { item_name.copy(a); } /* We should return something different from FIELD_ITEM here */ enum Type type() const { return STRING_ITEM;} === modified file 'sql/item_strfunc.h' --- a/sql/item_strfunc.h 2012-05-07 08:29:18 +0000 +++ b/sql/item_strfunc.h 2012-05-16 06:42:17 +0000 @@ -464,7 +464,7 @@ public: safe_charset_converter, return string representation of this function call */ - virtual const NameString fully_qualified_func_name() const = 0; + virtual const Name_string fully_qualified_func_name() const = 0; }; @@ -479,7 +479,7 @@ public: maybe_null=1; } const char *func_name() const { return "database"; } - const NameString fully_qualified_func_name() const + const Name_string fully_qualified_func_name() const { return NAME_STRING("database()"); } }; @@ -506,7 +506,7 @@ public: (HOSTNAME_LENGTH + 1) * SYSTEM_CHARSET_MBMAXLEN); } const char *func_name() const { return "user"; } - const NameString fully_qualified_func_name() const + const Name_string fully_qualified_func_name() const { return NAME_STRING("user()"); } type_conversion_status save_in_field(Field *field, bool no_conversions) { @@ -524,7 +524,7 @@ public: : context(context_arg) {} bool fix_fields(THD *thd, Item **ref); const char *func_name() const { return "current_user"; } - const NameString fully_qualified_func_name() const + const Name_string fully_qualified_func_name() const { return NAME_STRING("current_user()"); } }; === modified file 'sql/item_xmlfunc.cc' --- a/sql/item_xmlfunc.cc 2012-04-17 14:37:50 +0000 +++ b/sql/item_xmlfunc.cc 2012-05-16 06:42:17 +0000 @@ -2485,7 +2485,7 @@ my_xpath_parse_VariableReference(MY_XPAT name.str= (char*) xpath->prevtok.beg; if (user_var) - xpath->item= new Item_func_get_user_var(NameString(name, false)); + xpath->item= new Item_func_get_user_var(Name_string(name, false)); else { sp_variable *spv; @@ -2495,7 +2495,7 @@ my_xpath_parse_VariableReference(MY_XPAT (spc= lex->get_sp_current_parsing_ctx()) && (spv= spc->find_variable(name, false))) { - Item_splocal *splocal= new Item_splocal(NameString(name, false), + Item_splocal *splocal= new Item_splocal(Name_string(name, false), spv->offset, spv->type, 0); #ifndef DBUG_OFF if (splocal) === modified file 'sql/log_event.cc' --- a/sql/log_event.cc 2012-05-11 10:15:28 +0000 +++ b/sql/log_event.cc 2012-05-16 06:42:17 +0000 @@ -7554,7 +7554,7 @@ int User_var_log_event::do_apply_event(R return 0; } } - Item_func_set_user_var e(NameString(name, name_len, false), it); + Item_func_set_user_var e(Name_string(name, name_len, false), it); /* Item_func_set_user_var can't substitute something else on its place => 0 can be passed as last argument (reference on item) === modified file 'sql/sql_show.cc' --- a/sql/sql_show.cc 2012-04-26 10:33:24 +0000 +++ b/sql/sql_show.cc 2012-05-16 06:42:17 +0000 @@ -6744,8 +6744,8 @@ TABLE *create_schema_table(THD *thd, TAB case MYSQL_TYPE_FLOAT: case MYSQL_TYPE_DOUBLE: { - const NameString field_name(fields_info->field_name, - strlen(fields_info->field_name)); + const Name_string field_name(fields_info->field_name, + strlen(fields_info->field_name)); if ((item= new Item_float(field_name, 0.0, NOT_FIXED_DEC, fields_info->field_length)) == NULL) DBUG_RETURN(NULL); === modified file 'sql/sql_show.h' --- a/sql/sql_show.h 2012-04-19 10:49:27 +0000 +++ b/sql/sql_show.h 2012-05-16 06:42:17 +0000 @@ -166,7 +166,7 @@ int copy_event_to_schema_table(THD *thd, void append_identifier(THD *thd, String *packet, const char *name, uint length); -inline void append_identifier(THD *thd, String *packet, SimpleCString str) +inline void append_identifier(THD *thd, String *packet, Simple_cstring str) { append_identifier(thd, packet, str.ptr(), static_cast(str.length())); } === modified file 'sql/sql_string.h' --- a/sql/sql_string.h 2012-04-19 10:49:27 +0000 +++ b/sql/sql_string.h 2012-05-16 06:42:17 +0000 @@ -29,12 +29,12 @@ in m_str is always in sync with m_length. This class must stay as small as possible as we often - pass it and its descendants (such as NameString) into functions + pass it and its descendants (such as Name_string) into functions using call-by-value evaluation. Don't add new members or virual methods into this class! */ -class SimpleCString +class Simple_cstring { private: const char *m_str; @@ -53,15 +53,15 @@ protected: m_length= length_arg; } public: - SimpleCString() + Simple_cstring() { set(NULL, 0); } - SimpleCString(const char *str_arg, size_t length_arg) + Simple_cstring(const char *str_arg, size_t length_arg) { set(str_arg, length_arg); } - SimpleCString(const LEX_STRING arg) + Simple_cstring(const LEX_STRING arg) { set(arg.str, arg.length); } @@ -89,9 +89,9 @@ public: */ size_t length() const { return m_length; } /** - Compare to another SimpleCString. + Compare to another Simple_cstring. */ - bool eq_bin(const SimpleCString other) const + bool eq_bin(const Simple_cstring other) const { return m_length == other.m_length && memcmp(m_str, other.m_str, m_length) == 0; @@ -375,7 +375,7 @@ public: { return append(ls->str, (uint32) ls->length); } - bool append(SimpleCString str) + bool append(Simple_cstring str) { return append(str.ptr(), static_cast(str.length())); } No bundle (reason: useless for push emails).