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

Function set_to_string

sql/strfunc.cc:353–382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351
352
353char *set_to_string(THD *thd, LEX_STRING *result, ulonglong set,
354 const char *lib[])
355{
356 char buff[STRING_BUFFER_USUAL_SIZE*8];
357 String tmp(buff, sizeof(buff), &my_charset_latin1);
358 LEX_STRING unused;
359
360 if (!result)
361 result= &unused;
362
363 tmp.length(0);
364
365 for (uint i= 0; set; i++, set >>= 1)
366 if (set & 1) {
367 tmp.append(lib[i]);
368 tmp.append(',');
369 }
370
371 if (tmp.length())
372 {
373 result->str= thd->strmake(tmp.ptr(), tmp.length()-1);
374 result->length= tmp.length()-1;
375 }
376 else
377 {
378 result->str= const_cast<char*>("");
379 result->length= 0;
380 }
381 return result->str;
382}
383
384char *flagset_to_string(THD *thd, LEX_STRING *result, ulonglong set,
385 const char *lib[])

Callers 3

session_value_ptrMethod · 0.85
global_value_ptrMethod · 0.85

Calls 4

strmakeMethod · 0.80
lengthMethod · 0.45
appendMethod · 0.45
ptrMethod · 0.45

Tested by

no test coverage detected