| 417 | |
| 418 | |
| 419 | void Name_string::copy(const char *str, size_t length, const CHARSET_INFO *cs) |
| 420 | { |
| 421 | if (!length) |
| 422 | { |
| 423 | /* Empty string, used by AS or internal function like last_insert_id() */ |
| 424 | set(str ? "" : NULL, 0); |
| 425 | return; |
| 426 | } |
| 427 | if (cs->ctype) |
| 428 | { |
| 429 | /* |
| 430 | This will probably need a better implementation in the future: |
| 431 | a function in CHARSET_INFO structure. |
| 432 | */ |
| 433 | while (length && !my_isgraph(cs, *str)) |
| 434 | { // Fix problem with yacc |
| 435 | length--; |
| 436 | str++; |
| 437 | } |
| 438 | } |
| 439 | if (!my_charset_same(cs, system_charset_info)) |
| 440 | { |
| 441 | size_t res_length; |
| 442 | char *tmp= sql_strmake_with_convert(str, length, cs, MAX_ALIAS_NAME, |
| 443 | system_charset_info, &res_length); |
| 444 | set(tmp, tmp ? res_length : 0); |
| 445 | } |
| 446 | else |
| 447 | { |
| 448 | size_t len= min<size_t>(length, MAX_ALIAS_NAME); |
| 449 | char *tmp= sql_strmake(str, len); |
| 450 | set(tmp, tmp ? len : 0); |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | |
| 455 | void Item_name_string::copy(const char *str_arg, size_t length_arg, |
no test coverage detected