MCPcopy Create free account
hub / github.com/MariaDB/server / init

Method init

storage/perfschema/pfs_variable.cc:505–555  ·  view source on GitHub ↗

Get sys_var value from global or local source then convert to string. */

Source from the content-addressed store, hash-verified

503 Get sys_var value from global or local source then convert to string.
504*/
505void System_variable::init(THD *target_thd, const SHOW_VAR *show_var,
506 enum_var_type query_scope)
507{
508 if (show_var == NULL || show_var->name == NULL)
509 return;
510
511 DBUG_ASSERT(show_var->type == SHOW_SYS);
512
513 m_name= show_var->name;
514 m_name_length= strlen(m_name);
515
516 /* Deprecated variables are ignored but must still be accounted for. */
517 if (m_ignore)
518 {
519 m_value_str[0]= '\0';
520 m_value_length= 0;
521 m_initialized= true;
522 return;
523 }
524
525 /* Block remote target thread from updating this system variable. */
526 /*XXX
527 THD *current_thread= current_thd;
528 if (target_thd != current_thread)
529 mysql_mutex_lock(&target_thd->LOCK_thd_sysvar);*/
530
531 sys_var *system_var= (sys_var *)show_var->value;
532 assert(system_var != NULL);
533 m_charset= system_var->charset(target_thd);
534 m_type= system_var->show_type();
535 m_scope= system_var->scope();
536
537 /* Get the value of the system variable. */
538 String buf(m_value_str, sizeof(m_value_str) - 1, system_charset_info);
539 if (!system_var->val_str_nolock(&buf, target_thd,
540 system_var->value_ptr(target_thd, query_scope, &null_clex_str)))
541 buf.length(0);
542
543 m_value_length= MY_MIN(buf.length(), SHOW_VAR_FUNC_BUFF_SIZE);
544
545 /* Returned value may reference a string other than m_value_str. */
546 if (buf.ptr() != m_value_str)
547 memcpy(m_value_str, buf.ptr(), m_value_length);
548 m_value_str[m_value_length]= 0;
549
550 /*XXX
551 if (target_thd != current_thread)
552 mysql_mutex_unlock(&target_thd->LOCK_thd_sysvar);*/
553
554 m_initialized= true;
555}
556
557
558/**

Callers 11

init_table_shareFunction · 0.45
init_setup_objectFunction · 0.45
init_programFunction · 0.45
init_userFunction · 0.45
init_instrumentsFunction · 0.45
init_accountFunction · 0.45
init_hostFunction · 0.45
init_setup_actorFunction · 0.45
init_prepared_stmtFunction · 0.45

Calls 8

get_one_variableFunction · 0.85
show_typeMethod · 0.80
val_str_nolockMethod · 0.80
value_ptrMethod · 0.80
charsetMethod · 0.45
scopeMethod · 0.45
lengthMethod · 0.45
ptrMethod · 0.45

Tested by

no test coverage detected