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


Public Member Functions | |
| Item_func_hex (Item *a) | |
| const char * | func_name () const |
| String * | val_str (String *) |
| void | fix_length_and_dec () |
| bool | check_partition_func_processor (byte *bool_arg) |
Private Attributes | |
| String | tmp_value |
Definition at line 586 of file item_strfunc.h.
| Item_func_hex::Item_func_hex | ( | Item * | a | ) | [inline] |
| void Item_func_hex::fix_length_and_dec | ( | ) | [inline, virtual] |
Implements Item_result_field.
Definition at line 593 of file item_strfunc.h.
References Item_func::args, DTCollation::collation, Item::collation, Item::decimals, Item::default_charset(), Item::max_length, charset_info_st::mbmaxlen, and DTCollation::set().
00594 { 00595 collation.set(default_charset()); 00596 decimals=0; 00597 max_length=args[0]->max_length*2*collation.collation->mbmaxlen; 00598 }
Here is the call graph for this function:

| const char* Item_func_hex::func_name | ( | ) | const [inline, virtual] |
Implements Item.
Definition at line 2507 of file item_strfunc.cc.
References String::alloc(), Item_func::args, String::copy(), DBUG_ASSERT, DECIMAL_RESULT, Item::default_charset(), Item::fixed, String::length(), longlong2str, LONGLONG_MIN, my_empty_string(), Item::null_value, octet2hex(), String::ptr(), REAL_RESULT, Item_str_func::result_type(), STRING_RESULT, tmp_value, ULONGLONG_MAX, Item_str_func::val_int(), Item::val_real(), and Item::val_str().
02508 { 02509 String *res; 02510 DBUG_ASSERT(fixed == 1); 02511 if (args[0]->result_type() != STRING_RESULT) 02512 { 02513 ulonglong dec; 02514 char ans[65],*ptr; 02515 /* Return hex of unsigned longlong value */ 02516 if (args[0]->result_type() == REAL_RESULT || 02517 args[0]->result_type() == DECIMAL_RESULT) 02518 { 02519 double val= args[0]->val_real(); 02520 if ((val <= (double) LONGLONG_MIN) || 02521 (val >= (double) (ulonglong) ULONGLONG_MAX)) 02522 dec= ~(longlong) 0; 02523 else 02524 dec= (ulonglong) (val + (val > 0 ? 0.5 : -0.5)); 02525 } 02526 else 02527 dec= (ulonglong) args[0]->val_int(); 02528 02529 if ((null_value= args[0]->null_value)) 02530 return 0; 02531 ptr= longlong2str(dec,ans,16); 02532 if (str->copy(ans,(uint32) (ptr-ans),default_charset())) 02533 return &my_empty_string; // End of memory 02534 return str; 02535 } 02536 02537 /* Convert given string to a hex string, character by character */ 02538 res= args[0]->val_str(str); 02539 if (!res || tmp_value.alloc(res->length()*2+1)) 02540 { 02541 null_value=1; 02542 return 0; 02543 } 02544 null_value=0; 02545 tmp_value.length(res->length()*2); 02546 02547 octet2hex((char*) tmp_value.ptr(), res->ptr(), res->length()); 02548 return &tmp_value; 02549 }
Here is the call graph for this function:

String Item_func_hex::tmp_value [private] |
1.4.7

