MySQL 8.0.39
Source Code Documentation
pfs_example_plugin_employee.cc File Reference

Macros

#define LOG_COMPONENT_TAG   "pfs_example_plugin_employee"
 

Functions

bool acquire_service_handles (MYSQL_PLUGIN p)
 acquire_service_handles does following: More...
 
void release_service_handles ()
 release_service_handles does following: More...
 
int ename_prepare_insert_row ()
 
int esalary_prepare_insert_row ()
 
int machine_prepare_insert_row ()
 
static bool pfs_example_func (MYSQL_PLUGIN p)
 pfs_example_func does following : More...
 
static int pfs_example_plugin_employee_init (void *p)
 Initialize the pfs_example_plugin_employee at server start or plugin installation. More...
 
static int pfs_example_plugin_employee_check (void *)
 
static int pfs_example_plugin_employee_deinit (void *p)
 Terminate the pfs_example_plugin_employee at server shutdown or plugin deinstallation. More...
 
 mysql_declare_plugin (pfs_example_plugin_employee)
 pfs_example_plugin_employee plugin descriptor More...
 

Variables

static const mysql_service_registry_treg_srv = nullptr
 
const mysql_service_log_builtins_tlog_bi = nullptr
 accessor built-ins More...
 
const mysql_service_log_builtins_string_tlog_bs = nullptr
 string built-ins More...
 
Ename_Record ename_array []
 
Esalary_Record esalary_array []
 
Machine_Record machine_array []
 
const mysql_service_registry_tr = nullptr
 
my_h_service h_ret_table_svc = nullptr
 
const mysql_service_pfs_plugin_table_v1_ttable_svc = nullptr
 
my_h_service h_ret_col_int_svc = nullptr
 
const mysql_service_pfs_plugin_column_integer_v1_tcol_int_svc = nullptr
 
my_h_service h_ret_col_string_svc = nullptr
 
const mysql_service_pfs_plugin_column_string_v2_tcol_string_svc = nullptr
 
my_h_service h_ret_col_bigint_svc = nullptr
 
const mysql_service_pfs_plugin_column_bigint_v1_tcol_bigint_svc = nullptr
 
my_h_service h_ret_col_date_svc = nullptr
 
const mysql_service_pfs_plugin_column_date_v1_tcol_date_svc = nullptr
 
my_h_service h_ret_col_time_svc = nullptr
 
const mysql_service_pfs_plugin_column_time_v1_tcol_time_svc = nullptr
 
my_h_service h_ret_col_enum_svc = nullptr
 
const mysql_service_pfs_plugin_column_enum_v1_tcol_enum_svc = nullptr
 
PFS_engine_table_share_proxyshare_list [4] = {nullptr, nullptr, nullptr, nullptr}
 
unsigned int share_list_count = 4
 
static PSI_mutex_key key_mutex_name
 
static PSI_mutex_key key_mutex_salary
 
static PSI_mutex_key key_mutex_machine
 
static PSI_mutex_info mutex_info []
 
static struct st_mysql_daemon pfs_example_plugin_employee
 
 mysql_declare_plugin_end
 

Macro Definition Documentation

◆ LOG_COMPONENT_TAG

#define LOG_COMPONENT_TAG   "pfs_example_plugin_employee"

Function Documentation

◆ acquire_service_handles()

bool acquire_service_handles ( MYSQL_PLUGIN  p)

acquire_service_handles does following:

  • Acquire the registry service for mysql_server.
  • Acquire pfs_plugin_table_v1 service implementation.

◆ ename_prepare_insert_row()

int ename_prepare_insert_row ( )

◆ esalary_prepare_insert_row()

int esalary_prepare_insert_row ( )

◆ machine_prepare_insert_row()

int machine_prepare_insert_row ( )

◆ mysql_declare_plugin()

mysql_declare_plugin ( pfs_example_plugin_employee  )

pfs_example_plugin_employee plugin descriptor

◆ pfs_example_func()

static bool pfs_example_func ( MYSQL_PLUGIN  p)
static

pfs_example_func does following :

  • Instantiate PFS_engine_table_share_proxy(s).
  • Prepare and insert rows in tables from here.
  • Acquire pfs_plugin_table_v1 service handle.
  • Call add_table method of pfs_plugin_table_v1 service.

Error messages are written to the server's error log. In case of success writes a single information message to the server's log.

Return values
falsesuccess
truefailure

Call add_tables function of pfs_plugin_table_v1 service to add plugin tables in performance schema.

◆ pfs_example_plugin_employee_check()

static int pfs_example_plugin_employee_check ( void *  )
static

◆ pfs_example_plugin_employee_deinit()

static int pfs_example_plugin_employee_deinit ( void *  p)
static

Terminate the pfs_example_plugin_employee at server shutdown or plugin deinstallation.

  • Delete/Drop plugin tables from Performance Schema.
  • Release pfs_plugin_table_v1 service handle.

Call delete_tables function of pfs_plugin_table_v1 service to delete plugin tables from performance schema

◆ pfs_example_plugin_employee_init()

static int pfs_example_plugin_employee_init ( void *  p)
static

Initialize the pfs_example_plugin_employee at server start or plugin installation.

  • Call pfs_example_func.

◆ release_service_handles()

void release_service_handles ( )

release_service_handles does following:

  • Release the handle to the pfs_plugin_table_v1 service.
  • Release the handle to registry service.

Variable Documentation

◆ col_bigint_svc

◆ col_date_svc

◆ col_enum_svc

◆ col_int_svc

◆ col_string_svc

◆ col_time_svc

◆ ename_array

Ename_Record ename_array[]
Initial value:
=
{
{{1, false}, "foo1", 4, "bar1", 4, true},
{{2, false}, "foo2", 4, "bar2", 4, true},
{{3, false}, "foo3", 4, "bar3", 4, true}
}

◆ esalary_array

Esalary_Record esalary_array[]
Initial value:
=
{
{{1, false}, {1000, false}, "2013-11-12", 10, "12:02:34", 8, true},
{{2, false}, {2000, false}, "2016-02-29", 10, "12:12:30", 8, true},
{{3, false}, {3000, false}, "2017-03-24", 10, "11:12:50", 8, true}
}

◆ h_ret_col_bigint_svc

my_h_service h_ret_col_bigint_svc = nullptr

◆ h_ret_col_date_svc

my_h_service h_ret_col_date_svc = nullptr

◆ h_ret_col_enum_svc

my_h_service h_ret_col_enum_svc = nullptr

◆ h_ret_col_int_svc

my_h_service h_ret_col_int_svc = nullptr

◆ h_ret_col_string_svc

my_h_service h_ret_col_string_svc = nullptr

◆ h_ret_col_time_svc

my_h_service h_ret_col_time_svc = nullptr

◆ h_ret_table_svc

my_h_service h_ret_table_svc = nullptr

◆ key_mutex_machine

PSI_mutex_key key_mutex_machine
static

◆ key_mutex_name

PSI_mutex_key key_mutex_name
static

◆ key_mutex_salary

PSI_mutex_key key_mutex_salary
static

◆ log_bi

accessor built-ins

accessor built-ins

◆ log_bs

string built-ins

◆ machine_array

Machine_Record machine_array[]
Initial value:
=
{
{{1, false}, {DESKTOP, false}, "Lenovo", 6, {1, false}, true},
{{2, false}, {LAPTOP, false}, "Dell", 4, {2, false}, true},
{{3, false}, {MOBILE, false}, "Apple", 5, {1, false}, true},
{{4, false}, {MOBILE, false}, "Samsung", 7, {1, false}, true},
{{5, false}, {LAPTOP, false}, "Lenovo", 6, {2, false}, true},
{{6, false}, {MOBILE, false}, "Nokia", 5, {2, false}, true},
{{7, false}, {LAPTOP, false}, "Apple", 5, {1, false}, true},
{{8, false}, {LAPTOP, false}, "HP", 2, {3, false}, true},
{{9, false}, {DESKTOP, false}, "Apple", 5, {3, false}, true},
}
@ LAPTOP
Definition: pfs_example_machine.h:46
@ DESKTOP
Definition: pfs_example_machine.h:46
@ MOBILE
Definition: pfs_example_machine.h:46

◆ mutex_info

PSI_mutex_info mutex_info[]
static
Initial value:
= {
{&key_mutex_name, "LOCK_ename_records_array",
"Mutex for the pfs_example_employee_name table."},
{&key_mutex_salary, "LOCK_esalary_records_array",
"Mutex for the pfs_example_employee_salary table."},
{&key_mutex_machine, "LOCK_machine_records_array",
"Mutex for the pfs_example_machine table."}
}
#define PSI_FLAG_SINGLETON
Singleton flag.
Definition: component_common.h:35
#define PSI_VOLATILITY_PERMANENT
Definition: psi_bits.h:154
static PSI_mutex_key key_mutex_salary
Definition: pfs_example_plugin_employee.cc:108
static PSI_mutex_key key_mutex_name
Definition: pfs_example_plugin_employee.cc:107
static PSI_mutex_key key_mutex_machine
Definition: pfs_example_plugin_employee.cc:109

◆ mysql_declare_plugin_end

mysql_declare_plugin_end

◆ pfs_example_plugin_employee

struct st_mysql_daemon pfs_example_plugin_employee
static
Initial value:
= {
#define MYSQL_DAEMON_INTERFACE_VERSION
Definition: plugin.h:669

◆ r

◆ reg_srv

const mysql_service_registry_t* reg_srv = nullptr
static

◆ share_list

◆ share_list_count

unsigned int share_list_count = 4

◆ table_svc