24 #include "string_service.h"
30 int mysql_string_convert_to_char_ptr(mysql_string_handle string_handle,
31 const char *charset_name,
33 unsigned int buffer_size,
37 int len= (int)my_convert(buffer, buffer_size - 1, &my_charset_utf8_general_ci,
38 str->ptr(), str->length(), str->charset(),
49 void mysql_string_free(mysql_string_handle string_handle)
51 my_free((
String *) string_handle);
59 void mysql_string_iterator_free(mysql_string_iterator_handle iterator_handle)
66 mysql_string_iterator_handle mysql_string_get_iterator(mysql_string_handle
72 iterator->iterator_str= str;
73 iterator->iterator_ptr= str->ptr();
80 int mysql_string_iterator_next(mysql_string_iterator_handle iterator_handle)
82 int char_len, char_type;
84 String *str= iterator->iterator_str;
86 char *end= (
char*) str->ptr() + str->length();
87 if (iterator->iterator_ptr == (
const char*) end)
89 char_len= (cs->cset->ctype(cs, &char_type, (uchar*) iterator->iterator_ptr,
91 iterator->ctype= char_type;
92 iterator->iterator_ptr+= (char_len > 0 ? char_len : (char_len < 0
102 int mysql_string_iterator_isupper(mysql_string_iterator_handle iterator_handle)
105 return (iterator->ctype & _MY_U);
113 int mysql_string_iterator_islower(mysql_string_iterator_handle iterator_handle)
116 return (iterator->ctype & _MY_L);
124 int mysql_string_iterator_isdigit(mysql_string_iterator_handle iterator_handle)
127 return (iterator->ctype & _MY_NMR);
135 mysql_string_handle mysql_string_to_lowercase(mysql_string_handle string_handle)
141 if (cs->casedn_multiply == 1)
144 len= cs->cset->casedn(cs, (
char*) str->ptr(), str->length(),
145 (
char*) str->ptr(), str->length());
151 uint len= str->length() * cs->casedn_multiply;
153 temp_str.set_charset(cs);
154 len= cs->cset->casedn(cs, (
char*) str->ptr(), str->length(),
155 (
char*) temp_str.ptr(), len);
156 temp_str.length(len);