Commit 2bcfab10 authored by serg@serg.mylan's avatar serg@serg.mylan

bug#3556 - soundex

parent 20ce5575
......@@ -77,9 +77,9 @@ bbbb bb bbbbbbbb aaaa bbbb
select replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') ;
replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL')
this is a REAL test
select soundex(''),soundex('he'),soundex('hello all folks');
soundex('') soundex('he') soundex('hello all folks')
H000 H4142
select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb');
soundex('') soundex('he') soundex('hello all folks') soundex('#3556 in bugdb')
H000 H4142 I51231
select md5('hello');
md5('hello')
5d41402abc4b2a76b9719d911017c592
......
......@@ -35,7 +35,7 @@ SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),r
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 soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb');
select md5('hello');
select sha('abc');
select sha1('abc');
......
......@@ -51,7 +51,7 @@ void soundex(register my_string out_pntr, my_string in_pntr,
if (remove_garbage)
{
while (*in_pntr && isspace(*in_pntr)) /* Skipp pre-space */
while (*in_pntr && !isalpha(*in_pntr))
in_pntr++;
}
*out_pntr++ = toupper(*in_pntr); /* Copy first letter */
......@@ -97,7 +97,7 @@ static char get_scode(char **ptr, pbool remove_garbage)
ch=toupper(**ptr);
if (ch < 'A' || ch > 'Z')
{
if (isalpha(ch)) /* If exetended alfa (country spec) */
if (isalpha(ch)) /* If extended alpha (country spec) */
return '0'; /* threat as vokal */
return 0; /* Can't map */
}
......
......@@ -1422,7 +1422,7 @@ String *Item_func_soundex::val_str(String *str)
char *to= (char *) tmp_value.ptr();
char *from= (char *) res->ptr(), *end=from+res->length();
while (from != end && isspace(*from)) // Skip pre-space
while (from != end && !isalpha(*from)) // Skip pre-space
from++; /* purecov: inspected */
if (from == end)
return &empty_string; // No alpha characters.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment