MCPcopy Create free account
hub / github.com/MariaDB/server / convert_string

Method convert_string

sql/sql_class.cc:2608–2628  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2606*/
2607
2608bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
2609 const char *from, size_t from_length,
2610 CHARSET_INFO *from_cs) const
2611{
2612 DBUG_ENTER("THD::convert_string");
2613 size_t new_length= to_cs->mbmaxlen * from_length;
2614 uint errors;
2615 if (unlikely(alloc_lex_string(to, new_length + 1)))
2616 DBUG_RETURN(true); // EOM
2617 to->length= copy_and_convert((char*) to->str, new_length, to_cs,
2618 from, from_length, from_cs, &errors);
2619 to->str[to->length]= 0; // Safety
2620 if (unlikely(errors) && lex->parse_vcol_expr)
2621 {
2622 my_error(ER_BAD_DATA, MYF(0),
2623 ErrConvString(from, from_length, from_cs).ptr(),
2624 to_cs->cs_name.str);
2625 DBUG_RETURN(true);
2626 }
2627 DBUG_RETURN(false);
2628}
2629
2630
2631/*

Callers 2

sql_parse.ccFile · 0.45
convertMethod · 0.45

Calls 9

copy_and_convertFunction · 0.85
my_errorFunction · 0.85
ErrConvStringClass · 0.85
ptrMethod · 0.45
copyMethod · 0.45
lengthMethod · 0.45
alloced_lengthMethod · 0.45
is_allocedMethod · 0.45
swapMethod · 0.45

Tested by

no test coverage detected