From c70cacacfef0dac99f56b6c2ed71c21d0da14a7b Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 2 Sep 2014 22:04:48 +0400 Subject: MDEV-6679 Different optimizer plan for "a BETWEEN 'string' AND ?" and "a BETWEEN ? AND 'string'" Item_string::eq() and Item_param::eq() in string context behaved differently. Introducing a new class Item_basic_value to share the eq() code between literals (Item_int, Item_double, Item_string, Item_null) and Item_param. --- sql/sql_string.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sql/sql_string.h') diff --git a/sql/sql_string.h b/sql/sql_string.h index cc1db1d214b..dbc1df0aaaf 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -540,6 +540,15 @@ public: } return TRUE; } + bool bin_eq(const String *other) const + { + return length() == other->length() && + !memcmp(ptr(), other->ptr(), length()); + } + bool eq(const String *other, CHARSET_INFO *cs) const + { + return !sortcmp(this, other, cs); + } }; -- cgit v1.2.1