| 1205 | */ |
| 1206 | |
| 1207 | bool 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 | /* |
no test coverage detected