MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / copy

Method copy

sql/item.cc:419–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

417
418
419void 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
455void Item_name_string::copy(const char *str_arg, size_t length_arg,

Callers 15

val_strMethod · 0.45
val_str_asciiMethod · 0.45
alloc_bufferFunction · 0.45
Buffered_logMethod · 0.45
val_strMethod · 0.45
str_set_decimalFunction · 0.45
str2my_decimalFunction · 0.45
make_old_formatFunction · 0.45
make_schemata_old_formatFunction · 0.45

Calls 6

my_charset_sameFunction · 0.85
sql_strmake_with_convertFunction · 0.85
sql_strmakeFunction · 0.85
copyFunction · 0.85
push_warning_printfFunction · 0.85
ptrMethod · 0.45

Tested by

no test coverage detected