The world's most popular open source database
#include <my_global.h>#include <my_sys.h>#include <m_string.h>#include <m_ctype.h>#include "sql_string.h"Include dependency graph for sql_string.cc:

Go to the source code of this file.
Functions | |
| gptr | sql_alloc (unsigned size) |
| void | sql_element_free (void *ptr) |
| int | sortcmp (const String *s, const String *t, CHARSET_INFO *cs) |
| int | stringcmp (const String *s, const String *t) |
| String * | copy_if_not_alloced (String *to, String *from, uint32 from_length) |
| uint32 | copy_and_convert (char *to, uint32 to_length, CHARSET_INFO *to_cs, const char *from, uint32 from_length, CHARSET_INFO *from_cs, uint *errors) |
| uint32 copy_and_convert | ( | char * | to, | |
| uint32 | to_length, | |||
| CHARSET_INFO * | to_cs, | |||
| const char * | from, | |||
| uint32 | from_length, | |||
| CHARSET_INFO * | from_cs, | |||
| uint * | errors | |||
| ) |
Definition at line 796 of file sql_string.cc.
Referenced by String::append(), check_connection(), String::copy(), dispatch_command(), Item_func_like::fix_fields(), get_dynamic_sql_string(), plugin_dl_add(), and sql_strmake_with_convert().
00799 { 00800 int cnvres; 00801 my_wc_t wc; 00802 const uchar *from_end= (const uchar*) from+from_length; 00803 char *to_start= to; 00804 uchar *to_end= (uchar*) to+to_length; 00805 int (*mb_wc)(struct charset_info_st *, my_wc_t *, const uchar *, 00806 const uchar *) = from_cs->cset->mb_wc; 00807 int (*wc_mb)(struct charset_info_st *, my_wc_t, uchar *s, uchar *e)= 00808 to_cs->cset->wc_mb; 00809 uint error_count= 0; 00810 00811 while (1) 00812 { 00813 if ((cnvres= (*mb_wc)(from_cs, &wc, (uchar*) from, 00814 from_end)) > 0) 00815 from+= cnvres; 00816 else if (cnvres == MY_CS_ILSEQ) 00817 { 00818 error_count++; 00819 from++; 00820 wc= '?'; 00821 } 00822 else 00823 break; // Impossible char. 00824 00825 outp: 00826 if ((cnvres= (*wc_mb)(to_cs, wc, (uchar*) to, to_end)) > 0) 00827 to+= cnvres; 00828 else if (cnvres == MY_CS_ILUNI && wc != '?') 00829 { 00830 error_count++; 00831 wc= '?'; 00832 goto outp; 00833 } 00834 else 00835 break; 00836 } 00837 *errors= error_count; 00838 return (uint32) (to - to_start); 00839 }
Here is the caller graph for this function:

Definition at line 754 of file sql_string.cc.
Referenced by Item_func_format::val_str(), Item_func_decode::val_str(), Item_func_encode::val_str(), Item_str_conv::val_str(), Item_func_insert::val_str(), and Item_func_replace::val_str().
00755 { 00756 if (from->Alloced_length >= from_length) 00757 return from; 00758 if (from->alloced || !to || from == to) 00759 { 00760 (void) from->realloc(from_length); 00761 return from; 00762 } 00763 if (to->realloc(from_length)) 00764 return from; // Actually an error 00765 if ((to->str_length=min(from->str_length,from_length))) 00766 memcpy(to->Ptr,from->Ptr,to->str_length); 00767 to->str_charset=from->str_charset; 00768 return to; 00769 }
Here is the caller graph for this function:

| int sortcmp | ( | const String * | s, | |
| const String * | t, | |||
| CHARSET_INFO * | cs | |||
| ) |
Definition at line 720 of file sql_string.cc.
Referenced by field_str::add(), Item_sum_max::add(), Item_sum_min::add(), cmp_item_sort_string::cmp(), Cached_item_str::cmp(), cmp_item_sort_string_in_static::compare(), cmp_item_sort_string::compare(), Arg_comparator::compare_e_string(), Arg_comparator::compare_string(), Item_hex_string::eq(), Item_param::eq(), Item_string::eq(), Item_func_case::find_item(), Item_sum_hybrid::min_max_update_str_field(), sortcmp2(), Item_func_field::val_int(), Item_func_between::val_int(), Item_func_strcmp::val_int(), and Item_func_min_max::val_str().
00721 { 00722 return cs->coll->strnncollsp(cs, 00723 (unsigned char *) s->ptr(),s->length(), 00724 (unsigned char *) t->ptr(),t->length(), 0); 00725 }
Here is the caller graph for this function:

| gptr sql_alloc | ( | unsigned | size | ) |
| void sql_element_free | ( | void * | ptr | ) |
Definition at line 746 of file sql_string.cc.
References cmp, int(), String::length(), memcmp(), min, and String::ptr().
Referenced by Arg_comparator::compare_e_binary_string(), Item_hex_string::eq(), Item_param::eq(), Item_string::eq(), and field_is_equal_to_item().
00747 { 00748 uint32 s_len=s->length(),t_len=t->length(),len=min(s_len,t_len); 00749 int cmp= memcmp(s->ptr(), t->ptr(), len); 00750 return (cmp) ? cmp : (int) (s_len - t_len); 00751 }
Here is the call graph for this function:

Here is the caller graph for this function:

1.4.7

