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


Public Member Functions | |
| Item_func_inet_ntoa (Item *a) | |
| String * | val_str (String *str) |
| const char * | func_name () const |
| void | fix_length_and_dec () |
| bool | check_partition_func_processor (byte *bool_arg) |
Definition at line 670 of file item_strfunc.h.
| Item_func_inet_ntoa::Item_func_inet_ntoa | ( | Item * | a | ) | [inline] |
| void Item_func_inet_ntoa::fix_length_and_dec | ( | ) | [inline, virtual] |
Implements Item_result_field.
Definition at line 678 of file item_strfunc.h.
References Item::decimals, and Item::max_length.
00678 { decimals = 0; max_length=3*8+7; }
| const char* Item_func_inet_ntoa::func_name | ( | ) | const [inline, virtual] |
Implements Item.
Definition at line 2733 of file item_strfunc.cc.
References String::append(), Item_func::args, buf, DBUG_ASSERT, Item::fixed, int4store, String::length(), LL, n, Item::null_value, p, and Item_str_func::val_int().
02734 { 02735 DBUG_ASSERT(fixed == 1); 02736 uchar buf[8], *p; 02737 ulonglong n = (ulonglong) args[0]->val_int(); 02738 char num[4]; 02739 02740 /* 02741 We do not know if args[0] is NULL until we have called 02742 some val function on it if args[0] is not a constant! 02743 02744 Also return null if n > 255.255.255.255 02745 */ 02746 if ((null_value= (args[0]->null_value || n > (ulonglong) LL(4294967295)))) 02747 return 0; // Null value 02748 02749 str->length(0); 02750 int4store(buf,n); 02751 02752 /* Now we can assume little endian. */ 02753 02754 num[3]='.'; 02755 for (p=buf+4 ; p-- > buf ; ) 02756 { 02757 uint c = *p; 02758 uint n1,n2; // Try to avoid divisions 02759 n1= c / 100; // 100 digits 02760 c-= n1*100; 02761 n2= c / 10; // 10 digits 02762 c-=n2*10; // last digit 02763 num[0]=(char) n1+'0'; 02764 num[1]=(char) n2+'0'; 02765 num[2]=(char) c+'0'; 02766 uint length=(n1 ? 4 : n2 ? 3 : 2); // Remove pre-zero 02767 02768 (void) str->append(num+4-length,length); 02769 } 02770 str->length(str->length()-1); // Remove last '.'; 02771 return str; 02772 }
Here is the call graph for this function:

1.4.7

