SlideShare uma empresa Scribd logo
1 de 11
Roland Bouman
http://rpbouman.blogspot.com/
1
Writing MySQL 5.1 Plugins
Roland Bouman
http://rpbouman.blogspot.com/
2
Tasks Before Implementing
Plugins
● Include header files:
– Standard headers: <stdlib.h>, <ctype.h>
– MySQL headers for Clean plugins:
<mysql/plugin.h>
– MySQL headers for Unclean plugins:
<mysql_version.h>
● Create a section for plugin declarations:
– mysql_declare_plugin(name)
– mysql_declare_plugin_end
Roland Bouman
http://rpbouman.blogspot.com/
3
Plug-in Declaration
#include <stdlib.h>
#include <ctype.h>
#include <mysql_version.h>
#include <mysql/plugin.h>
...
mysql_declare_plugin()
// your plugin descriptors go here...
{ ... plugin descriptor 1... }
, ...
, { ... plugin descriptor N... }
mysql_declare_plugin_end;
Roland Bouman
http://rpbouman.blogspot.com/
4
Generic Tasks to Implement an
Individual Plug-in
● General plug-in declaration
– st_mysql_plugin defined in plugin.h
● Plug-in type-specific descriptor
– defined in plugin.h
● init function
– Called on INSTALL PLUGIN or server start
● deinit function
– Called on UNINSTALL PLUGIN or shutdown
Roland Bouman
http://rpbouman.blogspot.com/
5
The Generic Plug-in Descriptor
struct st_mysql_plugin
{
int type; /* type constant */
void *info; /* type-specific descriptor */
const char *name; /* name */
const char *author; /* author */
const char *descr; /* description */
int license; /* license type constant */
int (*init)(void *); /* invoked when loaded */
int (*deinit)(void *); /* invoked when unloaded */
unsigned int version; /* plugin version */
struct st_mysql_show_var status_vars; /* status vars */
void * __reserved1; /* system variables */
void * __reserved2; /* config options */
};
Roland Bouman
http://rpbouman.blogspot.com/
6
Plug-in Descriptor Members (1)
● int type: a type constant
– MYSQL_STORAGE_ENGINE_PLUGIN
– MYSQL_FTPARSER_PLUGIN
– MYSQL_DAEMON_PLUGIN
– MYSQL_INFORMATION_SCHEMA_PLUGIN
● void *info: plug-in-type specific struct
– st_mysql_storage_engine
– st_mysql_ft_parser
– st_mysql_daemon
– st_mysql_information_schema
Roland Bouman
http://rpbouman.blogspot.com/
7
Plug-in Descriptor Members (2)
● const char *name: plug-in name
– INSTALL PLUGIN <name> ...
● Human readable metadata
– const char *author
– const char *descr
– int license
● All this is user visible in SHOW PLUGINS
Roland Bouman
http://rpbouman.blogspot.com/
8
Plug-in Descriptor Members (3)
● int (*init) (void *)
– Initialization function
– Invoked on INSTALL PLUGIN, server startup
● int (*deinit) (void *)
– Deinitalization function (cleanup)
– Invoked on UNINSTALL PLUGIN, shutdown
● Argument type is plugin type specific
Roland Bouman
http://rpbouman.blogspot.com/
9
Plug-in Descriptor Members (4)
● struct st_mysql_show_var *status_vars;
– Status variables
– Visible in SHOW STATUS
– Plug-in monitoring
● struct st_mysql_sys_var **system_vars;
– System variables
– Dynamic plug-in configuration
Roland Bouman
http://rpbouman.blogspot.com/
10
Minimal Daemon Plug-in:
Headers and Plug-in Declaration
#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
#include <mysql_version.h>
#include <mysql/plugin.h>
//... implementation goes here ...
mysql_declare_plugin(hello_world_daemon)
{
MYSQL_DAEMON_PLUGIN, /* type constant */
&hello_world_daemon_plugin, /* plugin-type specific */
"MYSQL_HELLO_DAEMON", /* Name */
"Roland Bouman (http://rpbouman.blogspot.com/)", /* Author */
"A 'Hello, World!' daemon plugin example.", /* Description */
PLUGIN_LICENSE_GPL, /* License */
hello_world_daemon_plugin_init, /* Init function */
hello_world_daemon_plugin_deinit, /* Deinit function */
0x0010, /* Version (1.0) */
NULL, /* status variables */
NULL, /* system variables */
NULL /* config options */
}
mysql_declare_plugin_end;
Roland Bouman
http://rpbouman.blogspot.com/
11
Minimal Daemon Plug-in:
Implementation
// Log initialization
static int hello_world_daemon_plugin_init(void *p)
{
fprintf(stderr, "hello_world_daemon_plugin_initn");
return 0;
}
// Log de-initialization
static int hello_world_daemon_plugin_deinit(void *p)
{
fprintf(stderr, "hello_world_daemon_plugin_deinitn");
return 0;
}
// plug-in type specific structure
struct st_mysql_daemon hello_world_daemon_plugin=
{ MYSQL_DAEMON_INTERFACE_VERSION };

Mais conteúdo relacionado

Mais procurados

Gdb basics for my sql db as (openfest 2017) final
Gdb basics for my sql db as (openfest 2017) finalGdb basics for my sql db as (openfest 2017) final
Gdb basics for my sql db as (openfest 2017) finalValeriy Kravchuk
 
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021Valeriy Kravchuk
 
E bpf and dynamic tracing for mariadb db as (mariadb day during fosdem 2020)
E bpf and dynamic tracing for mariadb db as (mariadb day during fosdem 2020)E bpf and dynamic tracing for mariadb db as (mariadb day during fosdem 2020)
E bpf and dynamic tracing for mariadb db as (mariadb day during fosdem 2020)Valeriy Kravchuk
 
Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)Valerii Kravchuk
 
MariaDB Server on macOS - FOSDEM 2022 MariaDB Devroom
MariaDB Server on macOS -  FOSDEM 2022 MariaDB DevroomMariaDB Server on macOS -  FOSDEM 2022 MariaDB Devroom
MariaDB Server on macOS - FOSDEM 2022 MariaDB DevroomValeriy Kravchuk
 
Apache Dispatch
Apache DispatchApache Dispatch
Apache DispatchFred Moyer
 
Automating with ansible (Part A)
Automating with ansible (Part A)Automating with ansible (Part A)
Automating with ansible (Part A)iman darabi
 
LSA2 - 03 Http apache nginx
LSA2 - 03 Http apache nginxLSA2 - 03 Http apache nginx
LSA2 - 03 Http apache nginxMarian Marinov
 
Tracing and profiling my sql (percona live europe 2019) draft_1
Tracing and profiling my sql (percona live europe 2019) draft_1Tracing and profiling my sql (percona live europe 2019) draft_1
Tracing and profiling my sql (percona live europe 2019) draft_1Valerii Kravchuk
 
FOSDEM 2015: gdb tips and tricks for MySQL DBAs
FOSDEM 2015: gdb tips and tricks for MySQL DBAsFOSDEM 2015: gdb tips and tricks for MySQL DBAs
FOSDEM 2015: gdb tips and tricks for MySQL DBAsValerii Kravchuk
 
PL-SQL DIFFERENT PROGRAMS
PL-SQL DIFFERENT PROGRAMSPL-SQL DIFFERENT PROGRAMS
PL-SQL DIFFERENT PROGRAMSraj upadhyay
 
GopherCon IL 2020 - Web Application Profiling 101
GopherCon IL 2020 - Web Application Profiling 101GopherCon IL 2020 - Web Application Profiling 101
GopherCon IL 2020 - Web Application Profiling 101yinonavraham
 
PHP 5.6 New and Deprecated Features
PHP 5.6  New and Deprecated FeaturesPHP 5.6  New and Deprecated Features
PHP 5.6 New and Deprecated FeaturesMark Niebergall
 
Database schema management in Ruby apps
Database schema management in Ruby appsDatabase schema management in Ruby apps
Database schema management in Ruby appsVsevolod Romashov
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6Wim Godden
 
Php classes in mumbai
Php classes in mumbaiPhp classes in mumbai
Php classes in mumbaiaadi Surve
 

Mais procurados (20)

Gdb basics for my sql db as (openfest 2017) final
Gdb basics for my sql db as (openfest 2017) finalGdb basics for my sql db as (openfest 2017) final
Gdb basics for my sql db as (openfest 2017) final
 
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021
 
E bpf and dynamic tracing for mariadb db as (mariadb day during fosdem 2020)
E bpf and dynamic tracing for mariadb db as (mariadb day during fosdem 2020)E bpf and dynamic tracing for mariadb db as (mariadb day during fosdem 2020)
E bpf and dynamic tracing for mariadb db as (mariadb day during fosdem 2020)
 
Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)
 
MariaDB Server on macOS - FOSDEM 2022 MariaDB Devroom
MariaDB Server on macOS -  FOSDEM 2022 MariaDB DevroomMariaDB Server on macOS -  FOSDEM 2022 MariaDB Devroom
MariaDB Server on macOS - FOSDEM 2022 MariaDB Devroom
 
Ruby meetup ROM
Ruby meetup ROMRuby meetup ROM
Ruby meetup ROM
 
Apache Dispatch
Apache DispatchApache Dispatch
Apache Dispatch
 
Automating with ansible (Part A)
Automating with ansible (Part A)Automating with ansible (Part A)
Automating with ansible (Part A)
 
Go replicator
Go replicatorGo replicator
Go replicator
 
LSA2 - 03 Http apache nginx
LSA2 - 03 Http apache nginxLSA2 - 03 Http apache nginx
LSA2 - 03 Http apache nginx
 
Tracing and profiling my sql (percona live europe 2019) draft_1
Tracing and profiling my sql (percona live europe 2019) draft_1Tracing and profiling my sql (percona live europe 2019) draft_1
Tracing and profiling my sql (percona live europe 2019) draft_1
 
FOSDEM 2015: gdb tips and tricks for MySQL DBAs
FOSDEM 2015: gdb tips and tricks for MySQL DBAsFOSDEM 2015: gdb tips and tricks for MySQL DBAs
FOSDEM 2015: gdb tips and tricks for MySQL DBAs
 
PL-SQL DIFFERENT PROGRAMS
PL-SQL DIFFERENT PROGRAMSPL-SQL DIFFERENT PROGRAMS
PL-SQL DIFFERENT PROGRAMS
 
GopherCon IL 2020 - Web Application Profiling 101
GopherCon IL 2020 - Web Application Profiling 101GopherCon IL 2020 - Web Application Profiling 101
GopherCon IL 2020 - Web Application Profiling 101
 
PHP 5.6 New and Deprecated Features
PHP 5.6  New and Deprecated FeaturesPHP 5.6  New and Deprecated Features
PHP 5.6 New and Deprecated Features
 
Effective CMake
Effective CMakeEffective CMake
Effective CMake
 
PHP Lab
PHP LabPHP Lab
PHP Lab
 
Database schema management in Ruby apps
Database schema management in Ruby appsDatabase schema management in Ruby apps
Database schema management in Ruby apps
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6
 
Php classes in mumbai
Php classes in mumbaiPhp classes in mumbai
Php classes in mumbai
 

Semelhante a 2. writing MySql plugins general

EuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears TrainingEuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears TrainingAlessandro Molina
 
Developing Drizzle Replication Plugins
Developing Drizzle Replication PluginsDeveloping Drizzle Replication Plugins
Developing Drizzle Replication PluginsPadraig O'Sullivan
 
Open source projects with python
Open source projects with pythonOpen source projects with python
Open source projects with pythonroskakori
 
Introduction of unit test on android kernel
Introduction of unit test on android kernelIntroduction of unit test on android kernel
Introduction of unit test on android kernelJohnson Chou
 
Asian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On UblAsian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On Ublnewrforce
 
Bundling Packages and Deploying Applications with RPM
Bundling Packages and Deploying Applications with RPMBundling Packages and Deploying Applications with RPM
Bundling Packages and Deploying Applications with RPMAlexander Shopov
 
Log monitoring with Logstash and Icinga
Log monitoring with Logstash and IcingaLog monitoring with Logstash and Icinga
Log monitoring with Logstash and IcingaOlinData
 
How To Install Openbravo ERP 2.50 MP43 in Ubuntu
How To Install Openbravo ERP 2.50 MP43 in UbuntuHow To Install Openbravo ERP 2.50 MP43 in Ubuntu
How To Install Openbravo ERP 2.50 MP43 in UbuntuWirabumi Software
 
LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager Alison Chaiken
 
Oracle11g On Fedora14
Oracle11g On Fedora14Oracle11g On Fedora14
Oracle11g On Fedora14kmsa
 
nginx: writing your first module
nginx: writing your first modulenginx: writing your first module
nginx: writing your first moduleredivy
 
Sphinx + robot framework = documentation as result of functional testing
Sphinx + robot framework = documentation as result of functional testingSphinx + robot framework = documentation as result of functional testing
Sphinx + robot framework = documentation as result of functional testingplewicki
 
SnortReport Presentation
SnortReport PresentationSnortReport Presentation
SnortReport Presentationwebhostingguy
 

Semelhante a 2. writing MySql plugins general (20)

Intro django
Intro djangoIntro django
Intro django
 
EuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears TrainingEuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears Training
 
Developing Drizzle Replication Plugins
Developing Drizzle Replication PluginsDeveloping Drizzle Replication Plugins
Developing Drizzle Replication Plugins
 
Open source projects with python
Open source projects with pythonOpen source projects with python
Open source projects with python
 
Introduction of unit test on android kernel
Introduction of unit test on android kernelIntroduction of unit test on android kernel
Introduction of unit test on android kernel
 
Asian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On UblAsian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On Ubl
 
Apache Cheat Sheet
Apache Cheat SheetApache Cheat Sheet
Apache Cheat Sheet
 
Bundling Packages and Deploying Applications with RPM
Bundling Packages and Deploying Applications with RPMBundling Packages and Deploying Applications with RPM
Bundling Packages and Deploying Applications with RPM
 
Catalyst MVC
Catalyst MVCCatalyst MVC
Catalyst MVC
 
PHP Development Tools
PHP  Development ToolsPHP  Development Tools
PHP Development Tools
 
Fuel Plugins
Fuel PluginsFuel Plugins
Fuel Plugins
 
Log monitoring with Logstash and Icinga
Log monitoring with Logstash and IcingaLog monitoring with Logstash and Icinga
Log monitoring with Logstash and Icinga
 
How To Install Openbravo ERP 2.50 MP43 in Ubuntu
How To Install Openbravo ERP 2.50 MP43 in UbuntuHow To Install Openbravo ERP 2.50 MP43 in Ubuntu
How To Install Openbravo ERP 2.50 MP43 in Ubuntu
 
LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager
 
Oracle11g On Fedora14
Oracle11g On Fedora14Oracle11g On Fedora14
Oracle11g On Fedora14
 
Oracle11g on fedora14
Oracle11g on fedora14Oracle11g on fedora14
Oracle11g on fedora14
 
nginx: writing your first module
nginx: writing your first modulenginx: writing your first module
nginx: writing your first module
 
Sphinx + robot framework = documentation as result of functional testing
Sphinx + robot framework = documentation as result of functional testingSphinx + robot framework = documentation as result of functional testing
Sphinx + robot framework = documentation as result of functional testing
 
RPM Building
RPM BuildingRPM Building
RPM Building
 
SnortReport Presentation
SnortReport PresentationSnortReport Presentation
SnortReport Presentation
 

Mais de Roland Bouman

Beyond OData: Introducing the XML/A model for ui5
Beyond OData: Introducing the XML/A model for ui5Beyond OData: Introducing the XML/A model for ui5
Beyond OData: Introducing the XML/A model for ui5Roland Bouman
 
Moving and Transforming Data with Pentaho Data Integration 5.0 CE (aka Kettle)
Moving and Transforming Data with Pentaho Data Integration 5.0 CE (aka Kettle)Moving and Transforming Data with Pentaho Data Integration 5.0 CE (aka Kettle)
Moving and Transforming Data with Pentaho Data Integration 5.0 CE (aka Kettle)Roland Bouman
 
Writing MySQL User-defined Functions in JavaScript
Writing MySQL User-defined Functions in JavaScriptWriting MySQL User-defined Functions in JavaScript
Writing MySQL User-defined Functions in JavaScriptRoland Bouman
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012Roland Bouman
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012Roland Bouman
 
Roland bouman modern_data_warehouse_architectures_data_vault_and_anchor_model...
Roland bouman modern_data_warehouse_architectures_data_vault_and_anchor_model...Roland bouman modern_data_warehouse_architectures_data_vault_and_anchor_model...
Roland bouman modern_data_warehouse_architectures_data_vault_and_anchor_model...Roland Bouman
 

Mais de Roland Bouman (7)

Beyond OData: Introducing the XML/A model for ui5
Beyond OData: Introducing the XML/A model for ui5Beyond OData: Introducing the XML/A model for ui5
Beyond OData: Introducing the XML/A model for ui5
 
Moving and Transforming Data with Pentaho Data Integration 5.0 CE (aka Kettle)
Moving and Transforming Data with Pentaho Data Integration 5.0 CE (aka Kettle)Moving and Transforming Data with Pentaho Data Integration 5.0 CE (aka Kettle)
Moving and Transforming Data with Pentaho Data Integration 5.0 CE (aka Kettle)
 
Xml4js pentaho
Xml4js pentahoXml4js pentaho
Xml4js pentaho
 
Writing MySQL User-defined Functions in JavaScript
Writing MySQL User-defined Functions in JavaScriptWriting MySQL User-defined Functions in JavaScript
Writing MySQL User-defined Functions in JavaScript
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
 
Common schema my sql uc 2012
Common schema   my sql uc 2012Common schema   my sql uc 2012
Common schema my sql uc 2012
 
Roland bouman modern_data_warehouse_architectures_data_vault_and_anchor_model...
Roland bouman modern_data_warehouse_architectures_data_vault_and_anchor_model...Roland bouman modern_data_warehouse_architectures_data_vault_and_anchor_model...
Roland bouman modern_data_warehouse_architectures_data_vault_and_anchor_model...
 

Último

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 

Último (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

2. writing MySql plugins general

  • 2. Roland Bouman http://rpbouman.blogspot.com/ 2 Tasks Before Implementing Plugins ● Include header files: – Standard headers: <stdlib.h>, <ctype.h> – MySQL headers for Clean plugins: <mysql/plugin.h> – MySQL headers for Unclean plugins: <mysql_version.h> ● Create a section for plugin declarations: – mysql_declare_plugin(name) – mysql_declare_plugin_end
  • 3. Roland Bouman http://rpbouman.blogspot.com/ 3 Plug-in Declaration #include <stdlib.h> #include <ctype.h> #include <mysql_version.h> #include <mysql/plugin.h> ... mysql_declare_plugin() // your plugin descriptors go here... { ... plugin descriptor 1... } , ... , { ... plugin descriptor N... } mysql_declare_plugin_end;
  • 4. Roland Bouman http://rpbouman.blogspot.com/ 4 Generic Tasks to Implement an Individual Plug-in ● General plug-in declaration – st_mysql_plugin defined in plugin.h ● Plug-in type-specific descriptor – defined in plugin.h ● init function – Called on INSTALL PLUGIN or server start ● deinit function – Called on UNINSTALL PLUGIN or shutdown
  • 5. Roland Bouman http://rpbouman.blogspot.com/ 5 The Generic Plug-in Descriptor struct st_mysql_plugin { int type; /* type constant */ void *info; /* type-specific descriptor */ const char *name; /* name */ const char *author; /* author */ const char *descr; /* description */ int license; /* license type constant */ int (*init)(void *); /* invoked when loaded */ int (*deinit)(void *); /* invoked when unloaded */ unsigned int version; /* plugin version */ struct st_mysql_show_var status_vars; /* status vars */ void * __reserved1; /* system variables */ void * __reserved2; /* config options */ };
  • 6. Roland Bouman http://rpbouman.blogspot.com/ 6 Plug-in Descriptor Members (1) ● int type: a type constant – MYSQL_STORAGE_ENGINE_PLUGIN – MYSQL_FTPARSER_PLUGIN – MYSQL_DAEMON_PLUGIN – MYSQL_INFORMATION_SCHEMA_PLUGIN ● void *info: plug-in-type specific struct – st_mysql_storage_engine – st_mysql_ft_parser – st_mysql_daemon – st_mysql_information_schema
  • 7. Roland Bouman http://rpbouman.blogspot.com/ 7 Plug-in Descriptor Members (2) ● const char *name: plug-in name – INSTALL PLUGIN <name> ... ● Human readable metadata – const char *author – const char *descr – int license ● All this is user visible in SHOW PLUGINS
  • 8. Roland Bouman http://rpbouman.blogspot.com/ 8 Plug-in Descriptor Members (3) ● int (*init) (void *) – Initialization function – Invoked on INSTALL PLUGIN, server startup ● int (*deinit) (void *) – Deinitalization function (cleanup) – Invoked on UNINSTALL PLUGIN, shutdown ● Argument type is plugin type specific
  • 9. Roland Bouman http://rpbouman.blogspot.com/ 9 Plug-in Descriptor Members (4) ● struct st_mysql_show_var *status_vars; – Status variables – Visible in SHOW STATUS – Plug-in monitoring ● struct st_mysql_sys_var **system_vars; – System variables – Dynamic plug-in configuration
  • 10. Roland Bouman http://rpbouman.blogspot.com/ 10 Minimal Daemon Plug-in: Headers and Plug-in Declaration #include <stdlib.h> #include <ctype.h> #include <stdio.h> #include <mysql_version.h> #include <mysql/plugin.h> //... implementation goes here ... mysql_declare_plugin(hello_world_daemon) { MYSQL_DAEMON_PLUGIN, /* type constant */ &hello_world_daemon_plugin, /* plugin-type specific */ "MYSQL_HELLO_DAEMON", /* Name */ "Roland Bouman (http://rpbouman.blogspot.com/)", /* Author */ "A 'Hello, World!' daemon plugin example.", /* Description */ PLUGIN_LICENSE_GPL, /* License */ hello_world_daemon_plugin_init, /* Init function */ hello_world_daemon_plugin_deinit, /* Deinit function */ 0x0010, /* Version (1.0) */ NULL, /* status variables */ NULL, /* system variables */ NULL /* config options */ } mysql_declare_plugin_end;
  • 11. Roland Bouman http://rpbouman.blogspot.com/ 11 Minimal Daemon Plug-in: Implementation // Log initialization static int hello_world_daemon_plugin_init(void *p) { fprintf(stderr, "hello_world_daemon_plugin_initn"); return 0; } // Log de-initialization static int hello_world_daemon_plugin_deinit(void *p) { fprintf(stderr, "hello_world_daemon_plugin_deinitn"); return 0; } // plug-in type specific structure struct st_mysql_daemon hello_world_daemon_plugin= { MYSQL_DAEMON_INTERFACE_VERSION };