mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
add 'SOUNDS LIKE' syntax
This commit is contained in:
@ -90,6 +90,7 @@ tonu@x153.internalnet
|
||||
tonu@x3.internalnet
|
||||
venu@myvenu.com
|
||||
venu@work.mysql.com
|
||||
vva@eagle.mysql.r18.ru
|
||||
vva@genie.(none)
|
||||
walrus@mysql.com
|
||||
wax@mysql.com
|
||||
|
@ -32040,6 +32040,10 @@ a single backslash to be matched).
|
||||
@item expr NOT LIKE pat [ESCAPE 'escape-char']
|
||||
Same as @code{NOT (expr LIKE pat [ESCAPE 'escape-char'])}.
|
||||
|
||||
@findex SOUNDS LIKE
|
||||
@item expr SOUNDS LIKE expr
|
||||
Same as @code{SOUNDEX(expr)=SOUNDEX(expr)}.
|
||||
|
||||
@cindex mSQL compatibility
|
||||
@cindex compatibility, with mSQL
|
||||
@findex REGEXP
|
||||
|
@ -80,6 +80,21 @@ this is a REAL test
|
||||
select soundex(''),soundex('he'),soundex('hello all folks');
|
||||
soundex('') soundex('he') soundex('hello all folks')
|
||||
H000 H4142
|
||||
select 'mood' sounds like 'mud';
|
||||
'mood' sounds like 'mud'
|
||||
1
|
||||
select 'Glazgo' sounds like 'Liverpool';
|
||||
'Glazgo' sounds like 'Liverpool'
|
||||
0
|
||||
select null sounds like 'null';
|
||||
null sounds like 'null'
|
||||
NULL
|
||||
select 'null' sounds like null;
|
||||
'null' sounds like null
|
||||
NULL
|
||||
select null sounds like null;
|
||||
null sounds like null
|
||||
NULL
|
||||
select md5('hello');
|
||||
md5('hello')
|
||||
5d41402abc4b2a76b9719d911017c592
|
||||
|
@ -36,6 +36,11 @@ select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
|
||||
select replace('aaaa','a','b'),replace('aaaa','aa','b'),replace('aaaa','a','bb'),replace('aaaa','','b'),replace('bbbb','a','c');
|
||||
select replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') ;
|
||||
select soundex(''),soundex('he'),soundex('hello all folks');
|
||||
select 'mood' sounds like 'mud';
|
||||
select 'Glazgo' sounds like 'Liverpool';
|
||||
select null sounds like 'null';
|
||||
select 'null' sounds like null;
|
||||
select null sounds like null;
|
||||
select md5('hello');
|
||||
select sha('abc');
|
||||
select sha1('abc');
|
||||
|
@ -344,6 +344,7 @@ static SYMBOL symbols[] = {
|
||||
{ "SQL_NO_CACHE", SYM(SQL_NO_CACHE_SYM), 0, 0},
|
||||
{ "SQL_SMALL_RESULT", SYM(SQL_SMALL_RESULT),0,0},
|
||||
{ "SQL_THREAD", SYM(SQL_THREAD),0,0},
|
||||
{ "SOUNDS", SYM(SOUNDS_SYM),0,0},
|
||||
{ "SSL", SYM(SSL_SYM),0,0},
|
||||
{ "STRAIGHT_JOIN", SYM(STRAIGHT_JOIN),0,0},
|
||||
{ "START", SYM(START_SYM),0,0},
|
||||
|
@ -100,6 +100,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
|
||||
%token DIV_SYM
|
||||
%token EQ
|
||||
%token EQUAL_SYM
|
||||
%token SOUNDS_SYM
|
||||
%token GE
|
||||
%token GT_SYM
|
||||
%token LE
|
||||
@ -1833,6 +1834,7 @@ expr_expr:
|
||||
| expr OR expr { $$= new Item_cond_or($1,$3); }
|
||||
| expr XOR expr { $$= new Item_cond_xor($1,$3); }
|
||||
| expr AND expr { $$= new Item_cond_and($1,$3); }
|
||||
| expr SOUNDS_SYM LIKE expr { $$= Item_bool_func2::eq_creator(new Item_func_soundex($1), new Item_func_soundex($4));}
|
||||
| expr LIKE simple_expr opt_escape { $$= new Item_func_like($1,$3,$4); }
|
||||
| expr NOT LIKE simple_expr opt_escape { $$= new Item_func_not(new Item_func_like($1,$4,$5));}
|
||||
| expr REGEXP expr { $$= new Item_func_regex($1,$3); }
|
||||
@ -1879,6 +1881,7 @@ no_in_expr:
|
||||
| no_in_expr OR expr { $$= new Item_cond_or($1,$3); }
|
||||
| no_in_expr XOR expr { $$= new Item_cond_xor($1,$3); }
|
||||
| no_in_expr AND expr { $$= new Item_cond_and($1,$3); }
|
||||
| no_in_expr SOUNDS_SYM LIKE expr { $$= Item_bool_func2::eq_creator(new Item_func_soundex($1), new Item_func_soundex($4));}
|
||||
| no_in_expr LIKE simple_expr opt_escape { $$= new Item_func_like($1,$3,$4); }
|
||||
| no_in_expr NOT LIKE simple_expr opt_escape { $$= new Item_func_not(new Item_func_like($1,$4,$5)); }
|
||||
| no_in_expr REGEXP expr { $$= new Item_func_regex($1,$3); }
|
||||
@ -1933,6 +1936,7 @@ no_and_expr:
|
||||
| no_and_expr OR_OR_CONCAT expr { $$= or_or_concat(YYTHD, $1,$3); }
|
||||
| no_and_expr OR expr { $$= new Item_cond_or($1,$3); }
|
||||
| no_and_expr XOR expr { $$= new Item_cond_xor($1,$3); }
|
||||
| no_and_expr SOUNDS_SYM LIKE expr { $$= Item_bool_func2::eq_creator(new Item_func_soundex($1), new Item_func_soundex($4));}
|
||||
| no_and_expr LIKE simple_expr opt_escape { $$= new Item_func_like($1,$3,$4); }
|
||||
| no_and_expr NOT LIKE simple_expr opt_escape { $$= new Item_func_not(new Item_func_like($1,$4,$5)); }
|
||||
| no_and_expr REGEXP expr { $$= new Item_func_regex($1,$3); }
|
||||
@ -3870,6 +3874,7 @@ keyword:
|
||||
| VALUE_SYM {}
|
||||
| WORK_SYM {}
|
||||
| YEAR_SYM {}
|
||||
| SOUNDS_SYM {}
|
||||
;
|
||||
|
||||
/* Option functions */
|
||||
|
Reference in New Issue
Block a user