diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 89391563f72e461c43db71655597fc9369a05714..15f884302a10d50097073d99c14ba41368b378ec 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -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 diff --git a/Docs/manual.texi b/Docs/manual.texi index 283ad00d80fbc97b5c95c2f80a178fd7a58b1d6c..0892203bca6a99f47d0c0ffff2d4235d2ff15b54 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -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 diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 69e37d7b9112c5092afbd96a2673ed227596c0b4..cee1d91d64d8b70ba6e8a164808db980870bed7c 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -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 diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 717b9c86a07dd19e12a73b1faaf87cbfe2500912..bd92182b1018e376b36e0144bfa6638b7d6b1671 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -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'); diff --git a/sql/lex.h b/sql/lex.h index eb03c0b36ec6b0f064ea5ee29317a7b7f1ff4e96..2497122c871982e76c091da17ab53778ca03a056 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -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}, diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index ed8e8f0fb51102264ec5b0b0ef6dd7a4ed9f0354..ab0a857a5b0e04e765272f4cbc90664dd6250e48 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -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 */