MySQL  8.0.18
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 = NULL
 
my_h_service h_ret_table_svc = NULL
 
const mysql_service_pfs_plugin_table_ttable_svc = NULL
 
PFS_engine_table_share_proxyshare_list [4] = {NULL, NULL, NULL, NULL}
 
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 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 service handle.
  • Call add_table method of pfs_plugin_table 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 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 service handle.

Call delete_tables function of pfs_plugin_table 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 service.
  • Release the handle to registry service.

Variable Documentation

◆ 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_table_svc

my_h_service h_ret_table_svc = NULL

◆ 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

const mysql_service_log_builtins_t* log_bi = nullptr

accessor built-ins

accessor built-ins

◆ log_bs

const mysql_service_log_builtins_string_t* log_bs = nullptr

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},
}
Definition: pfs_example_machine.h:43
Definition: pfs_example_machine.h:43
Definition: pfs_example_machine.h:43

◆ 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_VOLATILITY_PERMANENT
Definition: psi_base.h:114
static PSI_mutex_key key_mutex_machine
Definition: pfs_example_plugin_employee.cc:96
#define PSI_FLAG_SINGLETON
Singleton flag.
Definition: psi_base.h:54
static PSI_mutex_key key_mutex_name
Definition: pfs_example_plugin_employee.cc:94
static PSI_mutex_key key_mutex_salary
Definition: pfs_example_plugin_employee.cc:95

◆ 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:673

◆ 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