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


Public Member Functions | |
| Item_func_conv_charset (Item *a, CHARSET_INFO *cs) | |
| Item_func_conv_charset (Item *a, CHARSET_INFO *cs, bool cache_if_const) | |
| String * | val_str (String *) |
| void | fix_length_and_dec () |
| const char * | func_name () const |
| void | print (String *str) |
| bool | check_partition_func_processor (byte *bool_arg) |
Public Attributes | |
| bool | safe |
| CHARSET_INFO * | conv_charset |
Private Attributes | |
| bool | use_cached_value |
Definition at line 697 of file item_strfunc.h.
| Item_func_conv_charset::Item_func_conv_charset | ( | Item * | a, | |
| CHARSET_INFO * | cs | |||
| ) | [inline] |
Definition at line 703 of file item_strfunc.h.
References conv_charset, safe, and use_cached_value.
00703 :Item_str_func(a) 00704 { conv_charset= cs; use_cached_value= 0; safe= 0; }
| Item_func_conv_charset::Item_func_conv_charset | ( | Item * | a, | |
| CHARSET_INFO * | cs, | |||
| bool | cache_if_const | |||
| ) | [inline] |
Definition at line 705 of file item_strfunc.h.
References Item_func::args, String::charset(), DTCollation::collation, Item::collation, Item_func::const_item(), conv_charset, String::copy(), DBUG_ASSERT, Item::fixed, String::length(), String::mark_as_const(), my_charset_bin, MY_CS_UNICODE, Item::null_value, String::ptr(), safe, charset_info_st::state, Item::str_value, use_cached_value, and Item::val_str().
00706 :Item_str_func(a) 00707 { 00708 DBUG_ASSERT(args[0]->fixed); 00709 conv_charset= cs; 00710 if (cache_if_const && args[0]->const_item()) 00711 { 00712 uint errors= 0; 00713 String tmp, *str= args[0]->val_str(&tmp); 00714 if (!str || str_value.copy(str->ptr(), str->length(), 00715 str->charset(), conv_charset, &errors)) 00716 null_value= 1; 00717 use_cached_value= 1; 00718 str_value.mark_as_const(); 00719 safe= (errors == 0); 00720 } 00721 else 00722 { 00723 use_cached_value= 0; 00724 /* 00725 Conversion from and to "binary" is safe. 00726 Conversion to Unicode is safe. 00727 Other kind of conversions are potentially lossy. 00728 */ 00729 safe= (args[0]->collation.collation == &my_charset_bin || 00730 cs == &my_charset_bin || 00731 (cs->state & MY_CS_UNICODE)); 00732 } 00733 }
Here is the call graph for this function:

| void Item_func_conv_charset::fix_length_and_dec | ( | ) | [virtual] |
Implements Item_result_field.
Definition at line 2395 of file item_strfunc.cc.
References Item_func::args, Item::collation, conv_charset, DERIVATION_IMPLICIT, Item::max_length, charset_info_st::mbmaxlen, and DTCollation::set().
02396 { 02397 collation.set(conv_charset, DERIVATION_IMPLICIT); 02398 max_length = args[0]->max_length*conv_charset->mbmaxlen; 02399 }
Here is the call graph for this function:

| const char* Item_func_conv_charset::func_name | ( | ) | const [inline, virtual] |
| void Item_func_conv_charset::print | ( | String * | str | ) | [virtual] |
Reimplemented from Item_func.
Definition at line 2401 of file item_strfunc.cc.
References String::append(), Item_func::args, conv_charset, charset_info_st::csname, Item::print(), and STRING_WITH_LEN.
02402 { 02403 str->append(STRING_WITH_LEN("convert(")); 02404 args[0]->print(str); 02405 str->append(STRING_WITH_LEN(" using ")); 02406 str->append(conv_charset->csname); 02407 str->append(')'); 02408 }
Here is the call graph for this function:

Implements Item.
Definition at line 2378 of file item_strfunc.cc.
References Item_func::args, String::charset(), Item_str_func::check_well_formed_result(), conv_charset, String::copy(), DBUG_ASSERT, Item::fixed, String::length(), Item::null_value, String::ptr(), Item::str_value, use_cached_value, and Item::val_str().
02379 { 02380 DBUG_ASSERT(fixed == 1); 02381 if (use_cached_value) 02382 return null_value ? 0 : &str_value; 02383 String *arg= args[0]->val_str(str); 02384 uint dummy_errors; 02385 if (!arg) 02386 { 02387 null_value=1; 02388 return 0; 02389 } 02390 null_value= str_value.copy(arg->ptr(),arg->length(),arg->charset(), 02391 conv_charset, &dummy_errors); 02392 return null_value ? 0 : check_well_formed_result(&str_value); 02393 }
Here is the call graph for this function:

Definition at line 702 of file item_strfunc.h.
Referenced by fix_length_and_dec(), Item_func_conv_charset(), print(), and val_str().
Definition at line 701 of file item_strfunc.h.
Referenced by Item_func_conv_charset(), and Item::safe_charset_converter().
bool Item_func_conv_charset::use_cached_value [private] |
Definition at line 699 of file item_strfunc.h.
Referenced by Item_func_conv_charset(), and val_str().
1.4.7

