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

Method well_formed_copy

sql/sql_string.cc:1119–1137  ·  view source on GitHub ↗

Copy a string, with optional character set conversion, with optional left padding (for binary -> UCS2 conversion) Bad input bytes are replaced to '?'. The string that is written to "to" is always well-formed. @param to The destination string @param to_length Space available in "to" @param to_cs Character set of the "to" string @param from

Source from the content-addressed store, hash-verified

1117 @returns number of bytes that were written to 'to'
1118*/
1119uint
1120String_copier::well_formed_copy(CHARSET_INFO *to_cs,
1121 char *to, size_t to_length,
1122 CHARSET_INFO *from_cs,
1123 const char *from, size_t from_length,
1124 size_t nchars)
1125{
1126 if ((to_cs == &my_charset_bin) ||
1127 (from_cs == &my_charset_bin) ||
1128 (to_cs == from_cs) ||
1129 my_charset_same(from_cs, to_cs))
1130 {
1131 m_cannot_convert_error_pos= NULL;
1132 return (uint) to_cs->copy_fix(to, to_length, from, from_length,
1133 nchars, this);
1134 }
1135 return (uint) my_convert_fix(to_cs, to, to_length, from_cs, from, from_length,
1136 nchars, this, this);
1137}
1138
1139
1140/*

Callers 6

assign_fixed_stringFunction · 0.45
copy_fixMethod · 0.45
send_dataMethod · 0.45

Calls 3

my_charset_sameFunction · 0.85
my_convert_fixFunction · 0.85
copy_fixMethod · 0.45

Tested by

no test coverage detected