Scrivere plugin per MariaDB

Stai visualizzando una vecchia versione di questo article. Visualizza la versione più recente.

Panoramica

Generalmente parlando, scrivere plugin per MariaDB è molto simile a scriverli per MySQL.

Plugin di autenticazione

Si veda Pluggable Authentication.

Plugin di tipo Storage Engine

Gli Storage Engine possono estendere la sintassi di CREATE TABLE con clausole opzionali per i campi, gli indici e le tabelle. Si veda Estendere CREATE TABLE per ulteriori informazioni.

Struttura della dichiarazione dei plugin

In MariaDB 5.2 è stata introdotta una nuova dichiarazione dei plugin. Essa differisce da quella dei plugin di MySQL nei modi seguenti:

  1. non c'è l'inutile campo 'reserved' (l'ultimo nella dichiarazione dei plugin per MySQL)
  2. c'è una dichiarazione 'maturity'
  3. c'è un campo per la rappresentazione testuale vel campo version

MariaDB può caricare i plugin che hanno soltanto le dichiarazioni per MySQL, ma il numero di versione apparirà come '0', mentre maturity e author version appariranno come 'Unknown' nella tabella INFORMATION_SCHEMA.PLUGINS.

Per i plugin compilati (non caricati dinamicamente), la presenza della dichiarazione per MariaDB è obbligatoria.

Example Plugin Declaration

The MariaDB plugin declaration looks like this:

/* MariaDB plugin declaration */
maria_declare_plugin(example)
{
   MYSQL_STORAGE_ENGINE_PLUGIN, /* the plugin type (see include/mysql/plugin.h) */
   &example_storage_engine_info, /* pointer to type-specific plugin descriptor   */
   "EXAMPLEDB", /* plugin name */
   "John Smith",  /* plugin author */
   "Example of plugin interface", /* the plugin description */
   PLUGIN_LICENSE_GPL, /* the plugin license (see include/mysql/plugin.h) */
   example_init_func,   /* Pointer to plugin initialization function */
   example_deinit_func,  /* Pointer to plugin deinitialization function */
   0x0001 /* Numeric version 0xAABB means AA.BB veriosn */,
   example_status_variables,  /* Status variables */
   example_system_variables,  /* System variables */
   "0.1 example",  /* String version representation */
   MariaDB_PLUGIN_MATURITY_EXPERIMENTAL /* Maturity (see include/mysql/plugin.h)*/
}
maria_declare_plugin_end;

Commenti

Sto caricando i commenti......
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.