| 2606 | */ |
| 2607 | |
| 2608 | bool 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 | /* |
no test coverage detected