Below is the list of changes that have just been committed into a local
5.0 repository of andrey. When andrey does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1989 05/08/17 16:20:40 andrey@lmy004. +6 -0
better fix for bug #12595 - works correctly in NO_BACKSLASH_ESCAPES mode.
sql/sql_yacc.yy
1.415 05/08/17 16:19:48 andrey@lmy004. +8 -4
initialize Lex->escape_used and pass it on higher level in the stack as parameter
to Item_func_like's constructor
sql/sql_lex.h
1.194 05/08/17 16:19:48 andrey@lmy004. +3 -0
add escape_used to indicate whether there is a ESCAPE clause or not
sql/sql_lex.cc
1.162 05/08/17 16:19:48 andrey@lmy004. +1 -0
initialize escape_used of struct st_lex
sql/sql_help.cc
1.49 05/08/17 16:19:47 andrey@lmy004. +2 -1
pass FALSE - there is not ESCAPE in the simulated query, the server will use \ as
escape
sql/item_cmpfunc.h
1.107 05/08/17 16:19:47 andrey@lmy004. +4 -2
get information whether there is ESCAPE in the query or not
sql/item_cmpfunc.cc
1.168 05/08/17 16:19:47 andrey@lmy004. +2 -2
check the length only when there was ESCAPE in the query
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: andrey
# Host: lmy004.
# Root: /work/mysql-5.0-bug12595
--- 1.167/sql/item_cmpfunc.cc 2005-08-16 20:54:48 +02:00
+++ 1.168/sql/item_cmpfunc.cc 2005-08-17 16:19:47 +02:00
@@ -2792,8 +2792,8 @@
{
/* If we are on execution stage */
String *escape_str= escape_item->val_str(&tmp_value1);
- /* ESCAPE must be 1 char in length.*/
- if (escape_str && escape_str->numchars() != 1)
+ /* We suppose we get valid data from the parser when ESCAPE wasn't found */
+ if (escape_str && escape_used_in_parsing && escape_str->numchars()
!= 1)
{
my_error(ER_WRONG_ARGUMENTS,MYF(0),"ESCAPE");
return TRUE;
--- 1.106/sql/item_cmpfunc.h 2005-08-13 07:12:56 +02:00
+++ 1.107/sql/item_cmpfunc.h 2005-08-17 16:19:47 +02:00
@@ -961,13 +961,15 @@
enum { alphabet_size = 256 };
Item *escape_item;
+ bool escape_used_in_parsing;
public:
char 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;
--- 1.161/sql/sql_lex.cc 2005-08-12 17:04:48 +02:00
+++ 1.162/sql/sql_lex.cc 2005-08-17 16:19:48 +02:00
@@ -173,6 +173,7 @@
lex->spcont= NULL;
lex->proc_list.first= 0;
lex->query_tables_own_last= 0;
+ lex->escape_used= FALSE;
if (lex->sroutines.records)
my_hash_reset(&lex->sroutines);
--- 1.193/sql/sql_lex.h 2005-08-15 17:31:01 +02:00
+++ 1.194/sql/sql_lex.h 2005-08-17 16:19:48 +02:00
@@ -869,6 +869,9 @@
*/
uchar *fname_start, *fname_end;
+ /* Was ESCAPE clause used or not */
+ bool escape_used;
+
st_lex();
virtual ~st_lex()
--- 1.414/sql/sql_yacc.yy 2005-08-15 17:31:02 +02:00
+++ 1.415/sql/sql_yacc.yy 2005-08-17 16:19:48 +02:00
@@ -4263,9 +4263,9 @@
{ $$= new Item_func_eq(new Item_func_soundex($1),
new Item_func_soundex($4)); }
| bit_expr LIKE simple_expr opt_escape
- { $$= new Item_func_like($1,$3,$4); }
+ { $$= new Item_func_like($1,$3,$4,Lex->escape_used); }
| bit_expr not LIKE simple_expr opt_escape
- { $$= new Item_func_not(new Item_func_like($1,$4,$5)); }
+ { $$= new Item_func_not(new Item_func_like($1,$4,$5,Lex->escape_used)); }
| bit_expr REGEXP bit_expr { $$= new Item_func_regex($1,$3); }
| bit_expr not REGEXP bit_expr
{ $$= negate_expression(YYTHD, new Item_func_regex($1,$4)); }
@@ -5594,10 +5594,14 @@
;
opt_escape:
- ESCAPE_SYM simple_expr { $$= $2; }
+ ESCAPE_SYM simple_expr
+ {
+ Lex->escape_used= TRUE;
+ $$= $2;
+ }
| /* empty */
{
-
+ Lex->escape_used= FALSE;
$$= ((YYTHD->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) ?
new Item_string("", 0, &my_charset_latin1) :
new Item_string("\\", 1, &my_charset_latin1));
--- 1.48/sql/sql_help.cc 2005-08-12 16:57:14 +02:00
+++ 1.49/sql/sql_help.cc 2005-08-17 16:19:47 +02:00
@@ -599,7 +599,8 @@
{
Item *cond= new Item_func_like(new Item_field(pfname),
new Item_string(mask,mlen,pfname->charset()),
- new Item_string("\\",1,&my_charset_latin1));
+ new Item_string("\\",1,&my_charset_latin1),
+ FALSE);
if (thd->is_fatal_error)
return 0; // OOM
return prepare_simple_select(thd, cond, table, error);
| Thread |
|---|
| • bk commit into 5.0 tree (andrey:1.1989) BUG#12595 | ahristov | 17 Aug |