The world's most popular open source database
#include <sql_string.h>
Inheritance diagram for String:


Public Member Functions | |
| String () | |
| String (uint32 length_arg) | |
| String (const char *str, CHARSET_INFO *cs) | |
| String (const char *str, uint32 len, CHARSET_INFO *cs) | |
| String (char *str, uint32 len, CHARSET_INFO *cs) | |
| String (const String &str) | |
| ~String () | |
| void | set_charset (CHARSET_INFO *charset) |
| CHARSET_INFO * | charset () const |
| uint32 | length () const |
| uint32 | alloced_length () const |
| char & | operator[] (uint32 i) const |
| void | length (uint32 len) |
| bool | is_empty () |
| const char * | ptr () const |
| char * | c_ptr () |
| char * | c_ptr_quick () |
| char * | c_ptr_safe () |
| void | set (String &str, uint32 offset, uint32 arg_length) |
| void | set (char *str, uint32 arg_length, CHARSET_INFO *cs) |
| void | set (const char *str, uint32 arg_length, CHARSET_INFO *cs) |
| bool | set_ascii (const char *str, uint32 arg_length) |
| void | set_quick (char *str, uint32 arg_length, CHARSET_INFO *cs) |
| bool | set (longlong num, CHARSET_INFO *cs) |
| bool | set (ulonglong num, CHARSET_INFO *cs) |
| bool | set (double num, uint decimals, CHARSET_INFO *cs) |
| void | chop () |
| void | free () |
| bool | alloc (uint32 arg_length) |
| bool | real_alloc (uint32 arg_length) |
| bool | realloc (uint32 arg_length) |
| void | shrink (uint32 arg_length) |
| bool | is_alloced () |
| String & | operator= (const String &s) |
| bool | copy () |
| bool | copy (const String &s) |
| bool | copy (const char *s, uint32 arg_length, CHARSET_INFO *cs) |
| bool | copy_aligned (const char *s, uint32 arg_length, uint32 offset, CHARSET_INFO *cs) |
| bool | set_or_copy_aligned (const char *s, uint32 arg_length, CHARSET_INFO *cs) |
| bool | copy (const char *s, uint32 arg_length, CHARSET_INFO *csfrom, CHARSET_INFO *csto, uint *errors) |
| bool | append (const String &s) |
| bool | append (const char *s) |
| bool | append (const char *s, uint32 arg_length) |
| bool | append (const char *s, uint32 arg_length, CHARSET_INFO *cs) |
| bool | append (IO_CACHE *file, uint32 arg_length) |
| bool | append_with_prefill (const char *s, uint32 arg_length, uint32 full_length, char fill_char) |
| int | strstr (const String &search, uint32 offset=0) |
| int | strrstr (const String &search, uint32 offset=0) |
| bool | replace (uint32 offset, uint32 arg_length, const char *to, uint32 length) |
| bool | replace (uint32 offset, uint32 arg_length, const String &to) |
| bool | append (char chr) |
| bool | fill (uint32 max_length, char fill) |
| void | strip_sp () |
| uint32 | numchars () |
| int | charpos (int i, uint32 offset=0) |
| int | reserve (uint32 space_needed) |
| int | reserve (uint32 space_needed, uint32 grow_by) |
| void | q_append (const char c) |
| void | q_append (const uint32 n) |
| void | q_append (double d) |
| void | q_append (double *d) |
| void | q_append (const char *data, uint32 data_len) |
| void | write_at_position (int position, uint32 value) |
| void | qs_append (const char *str, uint32 len) |
| void | qs_append (double d) |
| void | qs_append (double *d) |
| void | qs_append (const char c) |
| void | qs_append (int i) |
| void | qs_append (uint i) |
| char * | prep_append (uint32 arg_length, uint32 step_alloc) |
| bool | append (const char *s, uint32 arg_length, uint32 step_alloc) |
| void | print (String *print) |
| void | swap (String &s) |
| bool | uses_buffer_owned_by (const String *s) const |
| String () | |
| String (uint32 length_arg) | |
| String (const char *str, CHARSET_INFO *cs) | |
| String (const char *str, uint32 len, CHARSET_INFO *cs) | |
| String (char *str, uint32 len, CHARSET_INFO *cs) | |
| String (const String &str) | |
| ~String () | |
| void | set_charset (CHARSET_INFO *charset) |
| CHARSET_INFO * | charset () const |
| uint32 | length () const |
| uint32 | alloced_length () const |
| char & | operator[] (uint32 i) const |
| void | length (uint32 len) |
| bool | is_empty () |
| void | mark_as_const () |
| const char * | ptr () const |
| char * | c_ptr () |
| char * | c_ptr_quick () |
| char * | c_ptr_safe () |
| void | set (String &str, uint32 offset, uint32 arg_length) |
| void | set (char *str, uint32 arg_length, CHARSET_INFO *cs) |
| void | set (const char *str, uint32 arg_length, CHARSET_INFO *cs) |
| bool | set_ascii (const char *str, uint32 arg_length) |
| void | set_quick (char *str, uint32 arg_length, CHARSET_INFO *cs) |
| bool | set_int (longlong num, bool unsigned_flag, CHARSET_INFO *cs) |
| bool | set (longlong num, CHARSET_INFO *cs) |
| bool | set (ulonglong num, CHARSET_INFO *cs) |
| bool | set_real (double num, uint decimals, CHARSET_INFO *cs) |
| void | chop () |
| void | free () |
| bool | alloc (uint32 arg_length) |
| bool | real_alloc (uint32 arg_length) |
| bool | realloc (uint32 arg_length) |
| void | shrink (uint32 arg_length) |
| bool | is_alloced () |
| String & | operator= (const String &s) |
| bool | copy () |
| bool | copy (const String &s) |
| bool | copy (const char *s, uint32 arg_length, CHARSET_INFO *cs) |
| bool | copy_aligned (const char *s, uint32 arg_length, uint32 offset, CHARSET_INFO *cs) |
| bool | set_or_copy_aligned (const char *s, uint32 arg_length, CHARSET_INFO *cs) |
| bool | copy (const char *s, uint32 arg_length, CHARSET_INFO *csfrom, CHARSET_INFO *csto, uint *errors) |
| bool | append (const String &s) |
| bool | append (const char *s) |
| bool | append (const char *s, uint32 arg_length) |
| bool | append (const char *s, uint32 arg_length, CHARSET_INFO *cs) |
| bool | append (IO_CACHE *file, uint32 arg_length) |
| bool | append_with_prefill (const char *s, uint32 arg_length, uint32 full_length, char fill_char) |
| int | strstr (const String &search, uint32 offset=0) |
| int | strrstr (const String &search, uint32 offset=0) |
| bool | replace (uint32 offset, uint32 arg_length, const char *to, uint32 length) |
| bool | replace (uint32 offset, uint32 arg_length, const String &to) |
| bool | append (char chr) |
| bool | fill (uint32 max_length, char fill) |
| void | strip_sp () |
| uint32 | numchars () |
| int | charpos (int i, uint32 offset=0) |
| int | reserve (uint32 space_needed) |
| int | reserve (uint32 space_needed, uint32 grow_by) |
| void | q_append (const char c) |
| void | q_append (const uint32 n) |
| void | q_append (double d) |
| void | q_append (double *d) |
| void | q_append (const char *data, uint32 data_len) |
| void | write_at_position (int position, uint32 value) |
| void | qs_append (const char *str, uint32 len) |
| void | qs_append (double d) |
| void | qs_append (double *d) |
| void | qs_append (const char c) |
| void | qs_append (int i) |
| void | qs_append (uint i) |
| char * | prep_append (uint32 arg_length, uint32 step_alloc) |
| bool | append (const char *s, uint32 arg_length, uint32 step_alloc) |
| void | print (String *print) |
| void | swap (String &s) |
| bool | uses_buffer_owned_by (const String *s) const |
Static Public Member Functions | |
| static void * | operator new (size_t size, MEM_ROOT *mem_root) |
| static void | operator delete (void *ptr_arg, size_t size) |
| static void | operator delete (void *ptr_arg, MEM_ROOT *mem_root) |
| static bool | needs_conversion (uint32 arg_length, CHARSET_INFO *cs_from, CHARSET_INFO *cs_to, uint32 *offset) |
| static void * | operator new (size_t size, MEM_ROOT *mem_root) |
| static void | operator delete (void *ptr_arg, size_t size) |
| static void | operator delete (void *ptr_arg, MEM_ROOT *mem_root) |
| static bool | needs_conversion (uint32 arg_length, CHARSET_INFO *cs_from, CHARSET_INFO *cs_to, uint32 *offset) |
Private Attributes | |
| char * | Ptr |
| uint32 | str_length |
| uint32 | Alloced_length |
| bool | alloced |
| CHARSET_INFO * | str_charset |
| char * | Ptr |
| CHARSET_INFO * | str_charset |
Friends | |
| int | sortcmp (const String *a, const String *b, CHARSET_INFO *cs) |
| int | stringcmp (const String *a, const String *b) |
| String * | copy_if_not_alloced (String *a, String *b, uint32 arg_length) |
| int | sortcmp (const String *a, const String *b, CHARSET_INFO *cs) |
| int | stringcmp (const String *a, const String *b) |
| String * | copy_if_not_alloced (String *a, String *b, uint32 arg_length) |
Definition at line 34 of file sql_string.h.
| String::String | ( | ) | [inline] |
Definition at line 41 of file sql_string.h.
References alloced, Alloced_length, my_charset_bin, str_charset, and str_length.
00042 { 00043 Ptr=0; str_length=Alloced_length=0; alloced=0; 00044 str_charset= &my_charset_bin; 00045 }
| String::String | ( | uint32 | length_arg | ) | [inline] |
Definition at line 46 of file sql_string.h.
References alloced, Alloced_length, my_charset_bin, real_alloc(), and str_charset.
00047 { 00048 alloced=0; Alloced_length=0; (void) real_alloc(length_arg); 00049 str_charset= &my_charset_bin; 00050 }
Here is the call graph for this function:

| String::String | ( | const char * | str, | |
| CHARSET_INFO * | cs | |||
| ) | [inline] |
Definition at line 51 of file sql_string.h.
References alloced, Alloced_length, str_charset, str_length, and strlen().
00052 { 00053 Ptr=(char*) str; str_length=(uint) strlen(str); Alloced_length=0; alloced=0; 00054 str_charset=cs; 00055 }
Here is the call graph for this function:

| String::String | ( | const char * | str, | |
| uint32 | len, | |||
| CHARSET_INFO * | cs | |||
| ) | [inline] |
Definition at line 56 of file sql_string.h.
References alloced, Alloced_length, str_charset, and str_length.
00057 { 00058 Ptr=(char*) str; str_length=len; Alloced_length=0; alloced=0; 00059 str_charset=cs; 00060 }
| String::String | ( | char * | str, | |
| uint32 | len, | |||
| CHARSET_INFO * | cs | |||
| ) | [inline] |
Definition at line 61 of file sql_string.h.
References alloced, Alloced_length, str_charset, and str_length.
00062 { 00063 Ptr=(char*) str; Alloced_length=str_length=len; alloced=0; 00064 str_charset=cs; 00065 }
| String::String | ( | const String & | str | ) | [inline] |
Definition at line 66 of file sql_string.h.
References alloced, Alloced_length, Ptr, str_charset, and str_length.
00067 { 00068 Ptr=str.Ptr ; str_length=str.str_length ; 00069 Alloced_length=str.Alloced_length; alloced=0; 00070 str_charset=str.str_charset; 00071 }
| String::~String | ( | ) | [inline] |
Definition at line 78 of file sql_string.h.
References free().
00078 { free(); }
Here is the call graph for this function:

| String::String | ( | ) | [inline] |
Definition at line 41 of file sql_string.h.
References alloced, Alloced_length, my_charset_bin, str_charset, and str_length.
00042 { 00043 Ptr=0; str_length=Alloced_length=0; alloced=0; 00044 str_charset= &my_charset_bin; 00045 }
| String::String | ( | uint32 | length_arg | ) | [inline] |
Definition at line 46 of file sql_string.h.
References alloced, Alloced_length, my_charset_bin, real_alloc(), and str_charset.
00047 { 00048 alloced=0; Alloced_length=0; (void) real_alloc(length_arg); 00049 str_charset= &my_charset_bin; 00050 }
Here is the call graph for this function:

| String::String | ( | const char * | str, | |
| CHARSET_INFO * | cs | |||
| ) | [inline] |
Definition at line 51 of file sql_string.h.
References alloced, Alloced_length, str_charset, str_length, and strlen().
00052 { 00053 Ptr=(char*) str; str_length=(uint) strlen(str); Alloced_length=0; alloced=0; 00054 str_charset=cs; 00055 }
Here is the call graph for this function:

| String::String | ( | const char * | str, | |
| uint32 | len, | |||
| CHARSET_INFO * | cs | |||
| ) | [inline] |
Definition at line 56 of file sql_string.h.
References alloced, Alloced_length, str_charset, and str_length.
00057 { 00058 Ptr=(char*) str; str_length=len; Alloced_length=0; alloced=0; 00059 str_charset=cs; 00060 }
| String::String | ( | char * | str, | |
| uint32 | len, | |||
| CHARSET_INFO * | cs | |||
| ) | [inline] |
Definition at line 61 of file sql_string.h.
References alloced, Alloced_length, str_charset, and str_length.
00062 { 00063 Ptr=(char*) str; Alloced_length=str_length=len; alloced=0; 00064 str_charset=cs; 00065 }
| String::String | ( | const String & | str | ) | [inline] |
Definition at line 66 of file sql_string.h.
References alloced, Alloced_length, Ptr, str_charset, and str_length.
00067 { 00068 Ptr=str.Ptr ; str_length=str.str_length ; 00069 Alloced_length=str.Alloced_length; alloced=0; 00070 str_charset=str.str_charset; 00071 }
| String::~String | ( | ) | [inline] |
Definition at line 78 of file sql_string.h.
References free().
00078 { free(); }
Here is the call graph for this function:

Definition at line 187 of file sql_string.h.
References Alloced_length, and real_alloc().
00188 { 00189 if (arg_length < Alloced_length) 00190 return 0; 00191 return real_alloc(arg_length); 00192 }
Here is the call graph for this function:

Definition at line 183 of file sql_string.h.
References Alloced_length, and real_alloc().
Referenced by alloc_buffer(), copy(), copy_aligned(), Item_extract::fix_length_and_dec(), Item_date_add_interval::fix_length_and_dec(), ha_archive::get_row(), Item_func_user::init(), make_datetime(), my_decimal2string(), Protocol_prep::prepare_for_send(), read_and_execute(), set(), set_int(), set_real(), Field::val_int_as_str(), Item_nodeset_func_parentbyname::val_nodeset(), Item_nodeset_func_ancestorbyname::val_nodeset(), Item_nodeset_func_union::val_nodeset(), Item_nodeset_func::val_str(), Item_func_maketime::val_str(), Item_func_makedate::val_str(), Item_date_typecast::val_str(), Item_char_typecast::val_str(), Item_func_convert_tz::val_str(), Item_func_from_unixtime::val_str(), Item_func_date_format::val_str(), Item_func_sec_to_time::val_str(), Item_func_curdate::val_str(), Item_date::val_str(), Item_func_quote::val_str(), Item_load_file::val_str(), Item_func_unhex::val_str(), Item_func_hex::val_str(), Item_func_lpad::val_str(), Item_func_make_set::val_str(), Item_func_soundex::val_str(), Item_str_conv::val_str(), Item_func_concat_ws::val_str(), Item_func_des_decrypt::val_str(), Item_func_des_encrypt::val_str(), Item_func_concat::val_str(), Item_func_aes_decrypt::val_str(), Item_func_aes_encrypt::val_str(), Item_func_sha::val_str(), Item_func_md5::val_str(), and Field_timestamp::val_str().
00184 { 00185 if (arg_length < Alloced_length) 00186 return 0; 00187 return real_alloc(arg_length); 00188 }
Here is the call graph for this function:

Here is the caller graph for this function:

| uint32 String::alloced_length | ( | ) | const [inline] |
Definition at line 83 of file sql_string.h.
References Alloced_length.
00083 { return Alloced_length;}
| uint32 String::alloced_length | ( | ) | const [inline] |
Definition at line 83 of file sql_string.h.
References Alloced_length.
Referenced by alloc_buffer(), Cached_item_str::cmp(), Event_scheduler::dump_internal_status(), ha_archive::info(), read_and_execute(), Item_param::reset(), Field_bit_as_char::sql_type(), Field_bit::sql_type(), Field_varstring::sql_type(), Field_string::sql_type(), Field_year::sql_type(), Field_double::sql_type(), Field_float::sql_type(), Field_long::sql_type(), Field_medium::sql_type(), Field_short::sql_type(), Field_tiny::sql_type(), Field_new_decimal::sql_type(), Field_decimal::sql_type(), Item_char_typecast::val_str(), Item_func_reverse::val_str(), Item_func_concat_ws::val_str(), and Item_func_concat::val_str().
00083 { return Alloced_length;}
Here is the caller graph for this function:

Definition at line 340 of file sql_string.h.
References Alloced_length, FALSE, memcpy, realloc(), str_length, and TRUE.
00341 { 00342 uint32 new_length= arg_length + str_length; 00343 if (new_length > Alloced_length && realloc(new_length + step_alloc)) 00344 return TRUE; 00345 memcpy(Ptr+str_length, s, arg_length); 00346 str_length+= arg_length; 00347 return FALSE; 00348 }
Here is the call graph for this function:


