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

Function flagset_to_string

sql/strfunc.cc:384–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382}
383
384char *flagset_to_string(THD *thd, LEX_STRING *result, ulonglong set,
385 const char *lib[])
386{
387 char buff[STRING_BUFFER_USUAL_SIZE*8];
388 String tmp(buff, sizeof(buff), &my_charset_latin1);
389 LEX_STRING unused;
390
391 if (!result) result= &unused;
392
393 tmp.length(0);
394
395 // note that the last element is always "default", and it's ignored below
396 for (uint i= 0; lib[i+1]; i++, set >>= 1)
397 {
398 tmp.append(lib[i]);
399 tmp.append(set & 1 ? "=on," : "=off,");
400 }
401
402 result->str= thd->strmake(tmp.ptr(), tmp.length()-1);
403 result->length= tmp.length()-1;
404
405 return result->str;
406}
407

Callers 2

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