| 500 | */ |
| 501 | |
| 502 | static void do_cut_string_complex(const Copy_field *copy) |
| 503 | { // Shorter string field |
| 504 | CHARSET_INFO *cs= copy->from_field->charset(); |
| 505 | const uchar *from_end= copy->from_ptr + copy->from_length; |
| 506 | Well_formed_prefix prefix(cs, |
| 507 | (char*) copy->from_ptr, |
| 508 | (char*) from_end, |
| 509 | copy->to_length / cs->mbmaxlen); |
| 510 | size_t copy_length= prefix.length(); |
| 511 | if (copy->to_length < copy_length) |
| 512 | copy_length= copy->to_length; |
| 513 | memcpy(copy->to_ptr, copy->from_ptr, copy_length); |
| 514 | |
| 515 | /* Check if we lost any important characters */ |
| 516 | if (unlikely(prefix.well_formed_error_pos() || |
| 517 | cs->scan((char*) copy->from_ptr + copy_length, |
| 518 | (char*) from_end, |
| 519 | MY_SEQ_SPACES) < |
| 520 | (copy->from_length - copy_length))) |
| 521 | { |
| 522 | copy->to_field->set_warning(Sql_condition::WARN_LEVEL_WARN, |
| 523 | WARN_DATA_TRUNCATED, 1); |
| 524 | } |
| 525 | |
| 526 | if (copy_length < copy->to_length) |
| 527 | cs->fill((char*) copy->to_ptr + copy_length, |
| 528 | copy->to_length - copy_length, ' '); |
| 529 | } |
| 530 | |
| 531 | |
| 532 |
nothing calls this directly
no test coverage detected