MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / convert_string

Method convert_string

sql/sql_class.cc:1207–1223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1205*/
1206
1207bool THD::convert_string(LEX_STRING *to, const CHARSET_INFO *to_cs,
1208 const char *from, uint from_length,
1209 const CHARSET_INFO *from_cs)
1210{
1211 DBUG_ENTER("convert_string");
1212 size_t new_length= to_cs->mbmaxlen * from_length;
1213 uint dummy_errors;
1214 if (!(to->str= (char*) alloc(new_length+1)))
1215 {
1216 to->length= 0; // Safety fix
1217 DBUG_RETURN(1); // EOM
1218 }
1219 to->length= copy_and_convert((char*) to->str, new_length, to_cs,
1220 from, from_length, from_cs, &dummy_errors);
1221 to->str[to->length]=0; // Safety
1222 DBUG_RETURN(0);
1223}
1224
1225
1226/*

Callers 3

printMethod · 0.80
convert_str_valueMethod · 0.80

Calls 7

copy_and_convertFunction · 0.85
alloced_lengthMethod · 0.80
is_allocedMethod · 0.80
copyMethod · 0.45
ptrMethod · 0.45
lengthMethod · 0.45
swapMethod · 0.45

Tested by

no test coverage detected