#include <item.h>
Inheritance diagram for Item_string:


Public Member Functions | |
| Item_string (const char *str, uint length, CHARSET_INFO *cs, Derivation dv=DERIVATION_COERCIBLE) | |
| Item_string (CHARSET_INFO *cs, Derivation dv=DERIVATION_COERCIBLE) | |
| Item_string (const char *name_par, const char *str, uint length, CHARSET_INFO *cs, Derivation dv=DERIVATION_COERCIBLE) | |
| void | set_str_with_copy (const char *str_arg, uint length_arg) |
| enum Type | type () const |
| double | val_real () |
| longlong | val_int () |
| String * | val_str (String *) |
| my_decimal * | val_decimal (my_decimal *) |
| int | save_in_field (Field *field, bool no_conversions) |
| enum Item_result | result_type () const |
| enum_field_types | field_type () const |
| bool | basic_const_item () const |
| bool | eq (const Item *item, bool binary_cmp) const |
| Item * | new_item () |
| Item * | safe_charset_converter (CHARSET_INFO *tocs) |
| void | append (char *str, uint length) |
| void | print (String *str) |
| void | cleanup () |
| bool | check_partition_func_processor (byte *bool_arg) |
Definition at line 1672 of file item.h.
| Item_string::Item_string | ( | const char * | str, | |
| uint | length, | |||
| CHARSET_INFO * | cs, | |||
| Derivation | dv = DERIVATION_COERCIBLE | |||
| ) | [inline] |
Definition at line 1675 of file item.h.
References Item::collation, Item::decimals, Item::fixed, Item::max_length, charset_info_st::mbmaxlen, NOT_FIXED_DEC, String::numchars(), DTCollation::set(), Item::set_name(), String::set_or_copy_aligned(), and Item::str_value.
Referenced by new_item(), and safe_charset_converter().
01677 { 01678 collation.set(cs, dv); 01679 str_value.set_or_copy_aligned(str,length,cs); 01680 /* 01681 We have to have a different max_length than 'length' here to 01682 ensure that we get the right length if we do use the item 01683 to create a new table. In this case max_length must be the maximum 01684 number of chars for a string of this type because we in create_field:: 01685 divide the max_length with mbmaxlen). 01686 */ 01687 max_length= str_value.numchars()*cs->mbmaxlen; 01688 set_name(str, length, cs); 01689 decimals=NOT_FIXED_DEC; 01690 // it is constant => can be used without fix_fields (and frequently used) 01691 fixed= 1; 01692 }
Here is the call graph for this function:

Here is the caller graph for this function:

| Item_string::Item_string | ( | CHARSET_INFO * | cs, | |
| Derivation | dv = DERIVATION_COERCIBLE | |||
| ) | [inline] |
Definition at line 1694 of file item.h.
References Item::collation, Item::decimals, Item::fixed, Item::max_length, NOT_FIXED_DEC, NULL, DTCollation::set(), and Item::set_name().
01695 { 01696 collation.set(cs, dv); 01697 max_length= 0; 01698 set_name(NULL, 0, cs); 01699 decimals= NOT_FIXED_DEC; 01700 fixed= 1; 01701 }
Here is the call graph for this function:

| Item_string::Item_string | ( | const char * | name_par, | |
| const char * | str, | |||
| uint | length, | |||
| CHARSET_INFO * | cs, | |||
| Derivation | dv = DERIVATION_COERCIBLE | |||
| ) | [inline] |
Definition at line 1702 of file item.h.
References Item::collation, Item::decimals, Item::fixed, Item::max_length, charset_info_st::mbmaxlen, NOT_FIXED_DEC, String::numchars(), DTCollation::set(), Item::set_name(), String::set_or_copy_aligned(), and Item::str_value.
01704 { 01705 collation.set(cs, dv); 01706 str_value.set_or_copy_aligned(str,length,cs); 01707 max_length= str_value.numchars()*cs->mbmaxlen; 01708 set_name(name_par, 0, cs); 01709 decimals=NOT_FIXED_DEC; 01710 // it is constant => can be used without fix_fields (and frequently used) 01711 fixed= 1; 01712 }
Here is the call graph for this function:

| void Item_string::append | ( | char * | str, | |
| uint | length | |||
| ) | [inline] |
Definition at line 1742 of file item.h.
References String::append(), and Item::str_value.
Here is the call graph for this function:

| bool Item_string::basic_const_item | ( | ) | const [inline, virtual] |
Reimplemented from Item.
Reimplemented in Item_static_string_func, and Item_datetime.
Definition at line 1746 of file item.h.
| void Item_string::cleanup | ( | ) | [inline, virtual] |
Reimplemented from Item.
Definition at line 757 of file item.cc.
References Item::basic_const_item(), DTCollation::collation, Item::collation, sortcmp(), Item::str_value, stringcmp(), Item::type(), and type().
00758 { 00759 if (type() == item->type() && item->basic_const_item()) 00760 { 00761 if (binary_cmp) 00762 return !stringcmp(&str_value, &item->str_value); 00763 return (collation.collation == item->collation.collation && 00764 !sortcmp(&str_value, &item->str_value, collation.collation)); 00765 } 00766 return 0; 00767 }
Here is the call graph for this function:

| enum_field_types Item_string::field_type | ( | ) | const [inline, virtual] |
Reimplemented from Item.
Reimplemented in Item_datetime.
Definition at line 1733 of file item.h.
References MYSQL_TYPE_VARCHAR.
01733 { return MYSQL_TYPE_VARCHAR; }
| Item* Item_string::new_item | ( | ) | [inline, virtual] |
Reimplemented from Item.
Definition at line 1736 of file item.h.
References DTCollation::collation, Item::collation, Item_string(), String::length(), Item::name, String::ptr(), and Item::str_value.
01737 { 01738 return new Item_string(name, str_value.ptr(), 01739 str_value.length(), collation.collation); 01740 }
Here is the call graph for this function:

| void Item_string::print | ( | String * | str | ) | [virtual] |
Reimplemented from Item.
Reimplemented in Item_static_string_func.
Definition at line 2086 of file item.cc.
References String::append(), DTCollation::collation, Item::collation, charset_info_st::csname, String::print(), and Item::str_value.
02087 { 02088 str->append('_'); 02089 str->append(collation.collation->csname); 02090 str->append('\''); 02091 str_value.print(str); 02092 str->append('\''); 02093 }
Here is the call graph for this function:

| enum Item_result Item_string::result_type | ( | ) | const [inline, virtual] |
Reimplemented from Item.
Definition at line 1732 of file item.h.
References STRING_RESULT.
01732 { return STRING_RESULT; }
| Item * Item_string::safe_charset_converter | ( | CHARSET_INFO * | tocs | ) | [virtual] |
Reimplemented from Item.
Reimplemented in Item_static_string_func.
Definition at line 684 of file item.cc.
References String::charset(), Item::collation, String::copy(), current_thd, DTCollation::derivation, Item_string(), String::length(), String::mark_as_const(), NULL, String::ptr(), String::set(), Item::str_value, and val_str().
00685 { 00686 Item_string *conv; 00687 uint conv_errors; 00688 char *ptr; 00689 String tmp, cstr, *ostr= val_str(&tmp); 00690 cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs, &conv_errors); 00691 if (conv_errors || !(conv= new Item_string(cstr.ptr(), cstr.length(), 00692 cstr.charset(), 00693 collation.derivation))) 00694 { 00695 /* 00696 Safe conversion is not possible (or EOM). 00697 We could not convert a string into the requested character set 00698 without data loss. The target charset does not cover all the 00699 characters from the string. Operation cannot be done correctly. 00700 */ 00701 return NULL; 00702 } 00703 if (!(ptr= current_thd->memdup(cstr.ptr(), cstr.length() + 1 ))) 00704 return NULL; 00705 conv->str_value.set(ptr, cstr.length(), cstr.charset()); 00706 /* Ensure that no one is going to change the result string */ 00707 conv->str_value.mark_as_const(); 00708 return conv; 00709 }
Here is the call graph for this function:

Reimplemented from Item.
Definition at line 4228 of file item.cc.
References DTCollation::collation, Item::collation, String::length(), Item::null_value, String::ptr(), set_field_to_null(), Item::str_value, and val_str().
04229 { 04230 String *result; 04231 result=val_str(&str_value); 04232 if (null_value) 04233 return set_field_to_null(field); 04234 field->set_notnull(); 04235 return field->store(result->ptr(),result->length(),collation.collation); 04236 }
Here is the call graph for this function:

| void Item_string::set_str_with_copy | ( | const char * | str_arg, | |
| uint | length_arg | |||
| ) | [inline] |
Definition at line 1717 of file item.h.
References DTCollation::collation, Item::collation, String::copy(), Item::max_length, charset_info_st::mbmaxlen, String::numchars(), and Item::str_value.
01718 { 01719 str_value.copy(str_arg, length_arg, collation.collation); 01720 max_length= str_value.numchars() * collation.collation->mbmaxlen; 01721 }
Here is the call graph for this function:

| enum Type Item_string::type | ( | ) | const [inline, virtual] |
Implements Item.
Definition at line 1722 of file item.h.
References Item::STRING_ITEM.
Referenced by eq(), and Item_empty_string::make_field().
01722 { return STRING_ITEM; }
Here is the caller graph for this function:

| my_decimal * Item_string::val_decimal | ( | my_decimal * | ) | [virtual] |
Implements Item.
Definition at line 2154 of file item.cc.
References Item::val_decimal_from_string().
02155 { 02156 return val_decimal_from_string(decimal_value); 02157 }
Here is the call graph for this function:

| longlong Item_string::val_int | ( | ) | [virtual] |
Implements Item.
Definition at line 2128 of file item.cc.
References String::charset(), check_if_only_end_space(), charset_info_st::cset, current_thd, DBUG_ASSERT, ER, ER_TRUNCATED_WRONG_VALUE, err, Item::fixed, String::length(), String::ptr(), push_warning_printf(), Item::str_value, my_charset_handler_st::strtoll10, and MYSQL_ERROR::WARN_LEVEL_WARN.
02129 { 02130 DBUG_ASSERT(fixed == 1); 02131 int err; 02132 longlong tmp; 02133 char *end= (char*) str_value.ptr()+ str_value.length(); 02134 char *org_end= end; 02135 CHARSET_INFO *cs= str_value.charset(); 02136 02137 tmp= (*(cs->cset->strtoll10))(cs, str_value.ptr(), &end, &err); 02138 /* 02139 TODO: Give error if we wanted a signed integer and we got an unsigned 02140 one 02141 */ 02142 if (err > 0 || 02143 (end != org_end && !check_if_only_end_space(cs, end, org_end))) 02144 { 02145 push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, 02146 ER_TRUNCATED_WRONG_VALUE, 02147 ER(ER_TRUNCATED_WRONG_VALUE), "INTEGER", 02148 str_value.ptr()); 02149 } 02150 return tmp; 02151 }
Here is the call graph for this function:

| double Item_string::val_real | ( | ) | [virtual] |
Implements Item.
Definition at line 2102 of file item.cc.
References String::charset(), check_if_only_end_space(), current_thd, DBUG_ASSERT, ER, ER_TRUNCATED_WRONG_VALUE, error, Item::fixed, String::length(), my_strntod, String::ptr(), push_warning_printf(), Item::str_value, and MYSQL_ERROR::WARN_LEVEL_WARN.
02103 { 02104 DBUG_ASSERT(fixed == 1); 02105 int error; 02106 char *end, *org_end; 02107 double tmp; 02108 CHARSET_INFO *cs= str_value.charset(); 02109 02110 org_end= (char*) str_value.ptr() + str_value.length(); 02111 tmp= my_strntod(cs, (char*) str_value.ptr(), str_value.length(), &end, 02112 &error); 02113 if (error || (end != org_end && !check_if_only_end_space(cs, end, org_end))) 02114 { 02115 /* 02116 We can use str_value.ptr() here as Item_string is gurantee to put an 02117 end \0 here. 02118 */ 02119 push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, 02120 ER_TRUNCATED_WRONG_VALUE, 02121 ER(ER_TRUNCATED_WRONG_VALUE), "DOUBLE", 02122 str_value.ptr()); 02123 } 02124 return tmp; 02125 }
Here is the call graph for this function:

Implements Item.
Definition at line 1725 of file item.h.
References DBUG_ASSERT, Item::fixed, and Item::str_value.
Referenced by Item_static_string_func::safe_charset_converter(), safe_charset_converter(), and save_in_field().
01726 { 01727 DBUG_ASSERT(fixed == 1); 01728 return (String*) &str_value; 01729 }
Here is the caller graph for this function:

1.4.7

