| 430 | */ |
| 431 | |
| 432 | SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted, enum enum_var_type type) |
| 433 | { |
| 434 | int count= system_variable_hash.records, i; |
| 435 | int size= sizeof(SHOW_VAR) * (count + 1); |
| 436 | SHOW_VAR *result= (SHOW_VAR*) thd->alloc(size); |
| 437 | |
| 438 | if (result) |
| 439 | { |
| 440 | SHOW_VAR *show= result; |
| 441 | |
| 442 | for (i= 0; i < count; i++) |
| 443 | { |
| 444 | sys_var *var= (sys_var*) my_hash_element(&system_variable_hash, i); |
| 445 | const my_bool *hidden= |
| 446 | getopt_constraint_get_hidden_value(var->name.str, var->name.length, |
| 447 | FALSE); |
| 448 | |
| 449 | if (hidden && *hidden) |
| 450 | continue; |
| 451 | |
| 452 | // don't show session-only variables in SHOW GLOBAL VARIABLES |
| 453 | if (type == OPT_GLOBAL && var->check_type(type)) |
| 454 | continue; |
| 455 | |
| 456 | /* don't show non-visible variables */ |
| 457 | if (var->not_visible()) |
| 458 | continue; |
| 459 | |
| 460 | show->name= var->name.str; |
| 461 | show->value= (char*) var; |
| 462 | show->type= SHOW_SYS; |
| 463 | show++; |
| 464 | } |
| 465 | |
| 466 | /* sort into order */ |
| 467 | if (sorted) |
| 468 | my_qsort(result, show-result, sizeof(SHOW_VAR), |
| 469 | (qsort_cmp) show_cmp); |
| 470 | |
| 471 | /* make last element empty */ |
| 472 | memset(show, 0, sizeof(SHOW_VAR)); |
| 473 | } |
| 474 | return result; |
| 475 | } |
| 476 | |
| 477 | /** |
| 478 | Find a user set-table variable. |
nothing calls this directly
no test coverage detected