#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 786 of file sql_string.cc.
References charset_info_st::cset, e, int(), my_charset_handler_st::mb_wc, MY_CS_ILSEQ, MY_CS_ILUNI, MY_CS_TOOSMALL, my_wc_t, and my_charset_handler_st::wc_mb.
00789 { 00790 int cnvres; 00791 my_wc_t wc; 00792 const uchar *from_end= (const uchar*) from+from_length; 00793 char *to_start= to; 00794 uchar *to_end= (uchar*) to+to_length; 00795 int (*mb_wc)(struct charset_info_st *, my_wc_t *, const uchar *, 00796 const uchar *) = from_cs->cset->mb_wc; 00797 int (*wc_mb)(struct charset_info_st *, my_wc_t, uchar *s, uchar *e)= 00798 to_cs->cset->wc_mb; 00799 uint error_count= 0; 00800 00801 while (1) 00802 { 00803 if ((cnvres= (*mb_wc)(from_cs, &wc, (uchar*) from, 00804 from_end)) > 0) 00805 from+= cnvres; 00806 else if (cnvres == MY_CS_ILSEQ) 00807 { 00808 error_count++; 00809 from++; 00810 wc= '?'; 00811 } 00812 else if (cnvres > MY_CS_TOOSMALL) 00813 { 00814 /* 00815 A correct multibyte sequence detected 00816 But it doesn't have Unicode mapping. 00817 */ 00818 error_count++; 00819 from+= (-cnvres); 00820 wc= '?'; 00821 } 00822 else 00823 break; // Not enough characters 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 call graph for this function:

Definition at line 744 of file sql_string.cc.
References from, memcpy, min, and to.
00745 { 00746 if (from->Alloced_length >= from_length) 00747 return from; 00748 if (from->alloced || !to || from == to) 00749 { 00750 (void) from->realloc(from_length); 00751 return from; 00752 } 00753 if (to->realloc(from_length)) 00754 return from; // Actually an error 00755 if ((to->str_length=min(from->str_length,from_length))) 00756 memcpy(to->Ptr,from->Ptr,to->str_length); 00757 to->str_charset=from->str_charset; 00758 return to; 00759 }
| int sortcmp | ( | const String * | s, | |
| const String * | t, | |||
| CHARSET_INFO * | cs | |||
| ) |
Definition at line 710 of file sql_string.cc.
References charset_info_st::coll, String::length(), String::ptr(), and my_collation_handler_st::strnncollsp.
00711 { 00712 return cs->coll->strnncollsp(cs, 00713 (uchar *) s->ptr(),s->length(), 00714 (uchar *) t->ptr(),t->length(), 0); 00715 }
Here is the call graph for this function:

| gptr sql_alloc | ( | unsigned | size | ) |
| void sql_element_free | ( | void * | ptr | ) |
Definition at line 736 of file sql_string.cc.
References cmp, String::length(), memcmp(), min, and String::ptr().
00737 { 00738 uint32 s_len=s->length(),t_len=t->length(),len=min(s_len,t_len); 00739 int cmp= memcmp(s->ptr(), t->ptr(), len); 00740 return (cmp) ? cmp : (int) (s_len - t_len); 00741 }
Here is the call graph for this function:

1.4.7

