diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-03-30 18:53:33 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-04-10 13:12:36 +0200 |
commit | 08a901cc0bc13e7d0794a691ed139aa611ccc872 (patch) | |
tree | 7b31f3c653c5b7e8debfdc88fd24222196a3fcb6 | |
parent | 0dcb47cae93b8b25a1c1bd7ca31e0d2432df89f3 (diff) | |
download | mariadb-git-08a901cc0bc13e7d0794a691ed139aa611ccc872.tar.gz |
cleanup: remove XString::operator== and !=
use named methods instead.
-rw-r--r-- | sql/handler.cc | 17 | ||||
-rw-r--r-- | sql/lex_string.h | 9 | ||||
-rw-r--r-- | sql/sql_view.cc | 8 | ||||
-rw-r--r-- | sql/unireg.cc | 2 | ||||
-rw-r--r-- | sql/vers_string.h | 6 |
5 files changed, 23 insertions, 19 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 12674a19a52..fab3e2609a4 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -6825,12 +6825,12 @@ int del_global_index_stat(THD *thd, TABLE* table, KEY* key_info) bool Vers_parse_info::is_start(const char *name) const { DBUG_ASSERT(name); - return as_row.start && as_row.start == LString_i(name); + return as_row.start && as_row.start.streq(name); } bool Vers_parse_info::is_end(const char *name) const { DBUG_ASSERT(name); - return as_row.end && as_row.end == LString_i(name); + return as_row.end && as_row.end.streq(name); } bool Vers_parse_info::is_start(const Create_field &f) const { @@ -7014,8 +7014,7 @@ bool Table_scope_and_contents_source_st::vers_fix_system_fields( continue; DBUG_ASSERT(versioned_write); - if (vers_info.is_start(*f) && - vers_info.default_start == f->field_name) + if (vers_info.is_start(*f) && vers_info.default_start.streq(f->field_name)) { if (vers_info.as_row.start) it.remove(); @@ -7026,8 +7025,7 @@ bool Table_scope_and_contents_source_st::vers_fix_system_fields( } continue; } - if (vers_info.is_end(*f) && - vers_info.default_end == f->field_name) + if (vers_info.is_end(*f) && vers_info.default_end.streq(f->field_name)) { if (vers_info.as_row.end) it.remove(); @@ -7059,7 +7057,7 @@ bool Table_scope_and_contents_source_st::vers_fix_system_fields( Field *fld= static_cast<Item_field *>(item)->field; DBUG_ASSERT(fld); if ((fld->flags & sys_flag) && - LString_i(f->field_name) == fld->field_name) + lex_string_syseq(&f->field_name, &fld->field_name)) { f->field= fld; *versioned_write= false; @@ -7207,7 +7205,7 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info, if (f->versioning == Column_definition::WITHOUT_VERSIONING) f->flags|= VERS_UPDATE_UNVERSIONED_FLAG; - if (f->change.str && (start == f->change || end == f->change)) + if (f->change.str && (start.streq(f->change) || end.streq(f->change))) { my_error(ER_VERS_ALTER_SYSTEM_FIELD, MYF(0), f->change.str); return true; @@ -7315,7 +7313,8 @@ bool Vers_parse_info::check_with_conditions(const char *table_name) const return true; } - if (as_row.start != system_time.start || as_row.end != system_time.end) + if (!as_row.start.streq(system_time.start) || + !as_row.end.streq(system_time.end)) { my_error(ER_VERS_PERIOD_COLUMNS, MYF(0), as_row.start.str, as_row.end.str); return true; diff --git a/sql/lex_string.h b/sql/lex_string.h index 64c90bd2ac9..25f2c83a372 100644 --- a/sql/lex_string.h +++ b/sql/lex_string.h @@ -47,4 +47,13 @@ static inline bool lex_string_eq(const LEX_CSTRING *a, const LEX_CSTRING *b) return strcasecmp(a->str, b->str) == 0; } +/* + Compare if two LEX_CSTRING are equal in system character set + (field names, user variables, etc - but *not* table names) +*/ +static inline bool lex_string_syseq(const LEX_CSTRING *a, const LEX_CSTRING *b) +{ + return lex_string_cmp(system_charset_info, a, b) == 0; +} + #endif /* LEX_STRING_INCLUDED */ diff --git a/sql/sql_view.cc b/sql/sql_view.cc index b84dc46cae6..e910d48c75c 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -612,8 +612,8 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, const LString_i field_name= fld->field->field_name; if (s->tmp_table || (s->versioned && - (field_name == s->vers_start_field()->field_name || - field_name == s->vers_end_field()->field_name))) + (field_name.streq(s->vers_start_field()->field_name) || + field_name.streq(s->vers_end_field()->field_name)))) { continue; } @@ -2040,8 +2040,8 @@ bool insert_view_fields(THD *thd, List<Item> *list, TABLE_LIST *view) TABLE_SHARE *s= fld->context->table_list->table->s; LString_i field_name= fld->field_name; if (s->versioned && - (field_name == s->vers_start_field()->field_name || - field_name == s->vers_end_field()->field_name)) + (field_name.streq(s->vers_start_field()->field_name) || + field_name.streq(s->vers_end_field()->field_name))) continue; list->push_back(fld, thd->mem_root); } diff --git a/sql/unireg.cc b/sql/unireg.cc index 90e5d253304..496a41e4544 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -124,7 +124,7 @@ vers_get_field(HA_CREATE_INFO *create_info, List<Create_field> &create_fields, b for (unsigned field_no = 0; (sql_field = it++); ++field_no) { - if (row_field == sql_field->field_name) + if (row_field.streq(sql_field->field_name)) { DBUG_ASSERT(field_no <= uint16(~0U)); return uint16(field_no); diff --git a/sql/vers_string.h b/sql/vers_string.h index 0760613cd89..5460838510e 100644 --- a/sql/vers_string.h +++ b/sql/vers_string.h @@ -103,14 +103,10 @@ public: Storage(_str, strlen(_str), Compare::charset()) { } - bool operator== (const XString& b) const + bool streq(const XString& b) const { return Storage::length() == b.length() && 0 == Compare()(this->lex_cstring(), b.lex_cstring()); } - bool operator!= (const XString& b) const - { - return !(*this == b); - } operator const char* () const { return Storage::ptr(); |