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

Function thd_key_create

sql/sql_plugin.cc:4490–4506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4488static uint thd_key_no = 42;
4489
4490int thd_key_create(MYSQL_THD_KEY_T *key)
4491{
4492 int flags= PLUGIN_VAR_THDLOCAL | PLUGIN_VAR_STR |
4493 PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_NOCMDOPT;
4494 char namebuf[256];
4495 snprintf(namebuf, sizeof(namebuf), "%u", thd_key_no++);
4496 mysql_prlock_wrlock(&LOCK_system_variables_hash);
4497 // non-letters in the name as an extra safety
4498 st_bookmark *bookmark= register_var("\a\v\a\t\a\r", namebuf, flags);
4499 mysql_prlock_unlock(&LOCK_system_variables_hash);
4500 if (bookmark)
4501 {
4502 *key= bookmark->offset;
4503 return 0;
4504 }
4505 return ENOMEM;
4506}
4507
4508void thd_key_delete(MYSQL_THD_KEY_T *key)
4509{

Callers

nothing calls this directly

Calls 1

register_varFunction · 0.85

Tested by

no test coverage detected