diff options
author | unknown <andrey@lmy004.> | 2005-10-21 04:01:52 +0300 |
---|---|---|
committer | unknown <andrey@lmy004.> | 2005-10-21 04:01:52 +0300 |
commit | ccc051cd40bb58e66bf99ae471a4346be01be3c0 (patch) | |
tree | af8724f80a933665bab1d5eaf19869f59317ae0d /sql/item_cmpfunc.h | |
parent | 9e23aa1126c5fd820969cedd595b9a4b9e1df30e (diff) | |
download | mariadb-git-ccc051cd40bb58e66bf99ae471a4346be01be3c0.tar.gz |
fix for bug #12595 (ESCAPE must be exactly 1 character long)
ESCAPE has length of 1 if specified and sql_mode is NO_BACKSLASH_ESCAPES
or has length of 0 or 1 in every other situation.
(approved patch applied on a up-to-date tree re-commit)
mysql-test/r/select.result:
results of test for bug 12595
mysql-test/t/select.test:
test for bug #12595 (ESCAPE must be exactly one character long)
sql/item_cmpfunc.cc:
if ESCAPE was in the statement check whether its length is
different than 1. In NO_BACKSLASH_ESCAPES mode only length of 1 is
allowed, otherwise the length could be 0 or 1 character (code point
in the sense of Unicode).
sql/item_cmpfunc.h:
pass variable from the parsing stage - whether
ESCAPE clause was found in the statement
sql/sql_help.cc:
pass FALSE for escape_used_in_parsing because we
want the default mode of no error checking - our internal code.
sql/sql_lex.cc:
initialized variable used to transfer information during
parsing up in the stack when reducing in the grammar
sql/sql_lex.h:
new variable used for transfering information when
reducing in the grammar.
sql/sql_yacc.yy:
initialize Lex->escape_used and then use it when reducing.
This is needed as fix for bug #12595 to distinguish between
situation where ESCAPE was found and when not because internally
we may pass a string an empty string and there is no other way
to find out whether this is correct or not in case of
NO_BACKSLASH_ESCAPES mode, which allows only length of 1 if
ESCAPE is part of the SQL statement.
Diffstat (limited to 'sql/item_cmpfunc.h')
-rw-r--r-- | sql/item_cmpfunc.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index aa50593abf4..bfd32223d4c 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -985,13 +985,16 @@ class Item_func_like :public Item_bool_func2 enum { alphabet_size = 256 }; Item *escape_item; + + bool escape_used_in_parsing; public: int escape; - Item_func_like(Item *a,Item *b, Item *escape_arg) + Item_func_like(Item *a,Item *b, Item *escape_arg, bool escape_used) :Item_bool_func2(a,b), canDoTurboBM(FALSE), pattern(0), pattern_len(0), - bmGs(0), bmBc(0), escape_item(escape_arg) {} + bmGs(0), bmBc(0), escape_item(escape_arg), + escape_used_in_parsing(escape_used) {} longlong val_int(); enum Functype functype() const { return LIKE_FUNC; } optimize_type select_optimize() const; |