#include <item_strfunc.h>
Inheritance diagram for Item_func_soundex:


Public Member Functions | |
| Item_func_soundex (Item *a) | |
| String * | val_str (String *) |
| void | fix_length_and_dec () |
| const char * | func_name () const |
| bool | check_partition_func_processor (byte *bool_arg) |
Private Attributes | |
| String | tmp_value |
Definition at line 438 of file item_strfunc.h.
| Item_func_soundex::Item_func_soundex | ( | Item * | a | ) | [inline] |
| void Item_func_soundex::fix_length_and_dec | ( | ) | [virtual] |
Implements Item_result_field.
Definition at line 1741 of file item_strfunc.cc.
References Item_func::args, Item::collation, Item::max_length, DTCollation::set(), and set_if_bigger.
01742 { 01743 collation.set(args[0]->collation); 01744 max_length=args[0]->max_length; 01745 set_if_bigger(max_length,4); 01746 }
Here is the call graph for this function:

| const char* Item_func_soundex::func_name | ( | ) | const [inline, virtual] |
Implements Item.
Definition at line 1772 of file item_strfunc.cc.
References String::alloc(), Item_func::args, DTCollation::collation, Item::collation, DBUG_ASSERT, Item::fixed, from, get_scode(), String::length(), max, my_empty_string(), my_isalpha, Item::null_value, String::ptr(), String::set_charset(), soundex_toupper(), tmp_value, to, and Item::val_str().
01773 { 01774 DBUG_ASSERT(fixed == 1); 01775 String *res =args[0]->val_str(str); 01776 char last_ch,ch; 01777 CHARSET_INFO *cs= collation.collation; 01778 01779 if ((null_value=args[0]->null_value)) 01780 return 0; /* purecov: inspected */ 01781 01782 if (tmp_value.alloc(max(res->length(),4))) 01783 return str; /* purecov: inspected */ 01784 char *to= (char *) tmp_value.ptr(); 01785 char *from= (char *) res->ptr(), *end=from+res->length(); 01786 tmp_value.set_charset(cs); 01787 01788 while (from != end && !my_isalpha(cs,*from)) // Skip pre-space 01789 from++; /* purecov: inspected */ 01790 if (from == end) 01791 return &my_empty_string; // No alpha characters. 01792 *to++ = soundex_toupper(*from); // Copy first letter 01793 last_ch = get_scode(from); // code of the first letter 01794 // for the first 'double-letter check. 01795 // Loop on input letters until 01796 // end of input (null) or output 01797 // letter code count = 3 01798 for (from++ ; from < end ; from++) 01799 { 01800 if (!my_isalpha(cs,*from)) 01801 continue; 01802 ch=get_scode(from); 01803 if ((ch != '0') && (ch != last_ch)) // if not skipped or double 01804 { 01805 *to++ = ch; // letter, copy to output 01806 last_ch = ch; // save code of last input letter 01807 } // for next double-letter check 01808 } 01809 for (end=(char*) tmp_value.ptr()+4 ; to < end ; to++) 01810 *to = '0'; 01811 *to=0; // end string 01812 tmp_value.length((uint) (to-tmp_value.ptr())); 01813 return &tmp_value; 01814 }
Here is the call graph for this function:

String Item_func_soundex::tmp_value [private] |
1.4.7

