summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
Diffstat (limited to 'storage')
-rw-r--r--storage/archive/ha_archive.cc64
-rw-r--r--storage/archive/ha_archive.h2
-rw-r--r--storage/blackhole/ha_blackhole.cc70
-rw-r--r--storage/csv/ha_tina.cc53
-rw-r--r--storage/example/ha_example.cc68
5 files changed, 58 insertions, 199 deletions
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index e39ee976eb1..dad51c1a512 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -145,49 +145,7 @@ static handler *archive_create_handler(TABLE_SHARE *table);
*/
#define ARCHIVE_MIN_ROWS_TO_USE_BULK_INSERT 2
-
-static const char archive_hton_name[]= "ARCHIVE";
-static const char archive_hton_comment[]= "Archive storage engine";
-
-/* dummy handlerton - only to have something to return from archive_db_init */
-handlerton archive_hton = {
- MYSQL_HANDLERTON_INTERFACE_VERSION,
- archive_hton_name,
- SHOW_OPTION_YES,
- archive_hton_comment,
- DB_TYPE_ARCHIVE_DB,
- archive_db_init,
- 0, /* slot */
- 0, /* savepoint size. */
- NULL, /* close_connection */
- NULL, /* savepoint */
- NULL, /* rollback to savepoint */
- NULL, /* releas savepoint */
- NULL, /* commit */
- NULL, /* rollback */
- NULL, /* prepare */
- NULL, /* recover */
- NULL, /* commit_by_xid */
- NULL, /* rollback_by_xid */
- NULL, /* create_cursor_read_view */
- NULL, /* set_cursor_read_view */
- NULL, /* close_cursor_read_view */
- archive_create_handler, /* Create a new handler */
- NULL, /* Drop a database */
- archive_db_end, /* Panic call */
- NULL, /* Start Consistent Snapshot */
- NULL, /* Flush logs */
- NULL, /* Show status */
- NULL, /* Partition flags */
- NULL, /* Alter table flags */
- NULL, /* Alter interface */
- NULL, /* fill_files_table */
- HTON_NO_FLAGS,
- NULL, /* binlog_func */
- NULL, /* binlog_log_query */
- NULL /* release_temporary_latches */
-
-};
+handlerton archive_hton;
static handler *archive_create_handler(TABLE_SHARE *table)
{
@@ -217,11 +175,18 @@ static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length,
TRUE Error
*/
-bool archive_db_init()
+int archive_db_init()
{
DBUG_ENTER("archive_db_init");
if (archive_inited)
DBUG_RETURN(FALSE);
+
+ archive_hton.state=SHOW_OPTION_YES;
+ archive_hton.db_type=DB_TYPE_ARCHIVE_DB;
+ archive_hton.create=archive_create_handler;
+ archive_hton.panic=archive_db_end;
+ archive_hton.flags=HTON_NO_FLAGS;
+
if (pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST))
goto error;
if (hash_init(&archive_open_tables, system_charset_info, 32, 0, 0,
@@ -1575,16 +1540,19 @@ bool ha_archive::check_and_repair(THD *thd)
DBUG_RETURN(repair(thd, &check_opt));
}
+struct st_mysql_storage_engine archive_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION, &archive_hton };
mysql_declare_plugin(archive)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
- &archive_hton,
- archive_hton_name,
+ &archive_storage_engine,
+ "ARCHIVE",
"Brian Aker, MySQL AB",
- archive_hton_comment,
- NULL, /* Plugin Init */
+ "Archive storage engine",
+ archive_db_init, /* Plugin Init */
archive_db_done, /* Plugin Deinit */
0x0100 /* 1.0 */,
}
mysql_declare_plugin_end;
+
diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h
index 4663531b674..4c53c5c4064 100644
--- a/storage/archive/ha_archive.h
+++ b/storage/archive/ha_archive.h
@@ -136,6 +136,6 @@ public:
bool check_and_repair(THD *thd);
};
-bool archive_db_init(void);
+int archive_db_init(void);
int archive_db_end(ha_panic_function type);
diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc
index 098e44f39ee..3ee784c201f 100644
--- a/storage/blackhole/ha_blackhole.cc
+++ b/storage/blackhole/ha_blackhole.cc
@@ -22,57 +22,9 @@
#include "mysql_priv.h"
#include "ha_blackhole.h"
-#include <mysql/plugin.h>
-
/* Static declarations for handlerton */
-static handler *blackhole_create_handler(TABLE_SHARE *table);
-
-
-static const char blackhole_hton_name[]= "BLACKHOLE";
-static const char blackhole_hton_comment[]=
- "/dev/null storage engine (anything you write to it disappears)";
-
-/* Blackhole storage engine handlerton */
-
-handlerton blackhole_hton= {
- MYSQL_HANDLERTON_INTERFACE_VERSION,
- blackhole_hton_name,
- SHOW_OPTION_YES,
- blackhole_hton_comment,
- DB_TYPE_BLACKHOLE_DB,
- NULL,
- 0, /* slot */
- 0, /* savepoint size. */
- NULL, /* close_connection */
- NULL, /* savepoint */
- NULL, /* rollback to savepoint */
- NULL, /* release savepoint */
- NULL, /* commit */
- NULL, /* rollback */
- NULL, /* prepare */
- NULL, /* recover */
- NULL, /* commit_by_xid */
- NULL, /* rollback_by_xid */
- NULL, /* create_cursor_read_view */
- NULL, /* set_cursor_read_view */
- NULL, /* close_cursor_read_view */
- blackhole_create_handler, /* Create a new handler */
- NULL, /* Drop a database */
- NULL, /* Panic call */
- NULL, /* Start Consistent Snapshot */
- NULL, /* Flush logs */
- NULL, /* Show status */
- NULL, /* Partition flags */
- NULL, /* Alter table flags */
- NULL, /* Alter Tablespace */
- NULL, /* Fill FILES table */
- HTON_CAN_RECREATE | HTON_ALTER_CANNOT_CREATE,
- NULL, /* binlog_func */
- NULL, /* binlog_log_query */
- NULL /* release_temporary_latches */
-};
-
+handlerton blackhole_hton;
static handler *blackhole_create_handler(TABLE_SHARE *table)
{
@@ -256,14 +208,26 @@ int ha_blackhole::index_last(byte * buf)
DBUG_RETURN(HA_ERR_END_OF_FILE);
}
+static int blackhole_init()
+{
+ blackhole_hton.state= SHOW_OPTION_YES;
+ blackhole_hton.db_type= DB_TYPE_BLACKHOLE_DB;
+ blackhole_hton.create= blackhole_create_handler;
+ blackhole_hton.flags= HTON_CAN_RECREATE | HTON_ALTER_CANNOT_CREATE;
+ return 0;
+}
+
+struct st_mysql_storage_engine blackhole_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION, &blackhole_hton };
+
mysql_declare_plugin(blackhole)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
- &blackhole_hton,
- blackhole_hton_name,
+ &blackhole_storage_engine,
+ "BLACKHOLE",
"MySQL AB",
- blackhole_hton_comment,
- NULL, /* Plugin Init */
+ "/dev/null storage engine (anything you write to it disappears)",
+ blackhole_init, /* Plugin Init */
NULL, /* Plugin Deinit */
0x0100 /* 1.0 */,
}
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index de69df90ed5..b343a8739c9 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -77,45 +77,7 @@ static int tina_init= 0;
static handler *tina_create_handler(TABLE_SHARE *table);
static int tina_init_func();
-static const char tina_hton_name[]= "CSV";
-static const char tina_hton_comment[]= "CSV storage engine";
-
-handlerton tina_hton= {
- MYSQL_HANDLERTON_INTERFACE_VERSION,
- tina_hton_name,
- SHOW_OPTION_YES,
- tina_hton_comment,
- DB_TYPE_CSV_DB,
- (bool (*)()) tina_init_func,
- 0, /* slot */
- 0, /* savepoint size. */
- NULL, /* close_connection */
- NULL, /* savepoint */
- NULL, /* rollback to savepoint */
- NULL, /* release savepoint */
- NULL, /* commit */
- NULL, /* rollback */
- NULL, /* prepare */
- NULL, /* recover */
- NULL, /* commit_by_xid */
- NULL, /* rollback_by_xid */
- NULL, /* create_cursor_read_view */
- NULL, /* set_cursor_read_view */
- NULL, /* close_cursor_read_view */
- tina_create_handler, /* Create a new handler */
- NULL, /* Drop a database */
- tina_end, /* Panic call */
- NULL, /* Start Consistent Snapshot */
- NULL, /* Flush logs */
- NULL, /* Show status */
- NULL, /* Partition flags */
- NULL, /* Alter table flags */
- NULL, /* Alter Tablespace */
- NULL, /* Fill FILES Table */
- HTON_CAN_RECREATE,
- NULL, /* binlog_func */
- NULL /* binlog_log_query */
-};
+handlerton tina_hton;
/*****************************************************************************
** TINA tables
@@ -191,6 +153,11 @@ static int tina_init_func()
VOID(pthread_mutex_init(&tina_mutex,MY_MUTEX_INIT_FAST));
(void) hash_init(&tina_open_tables,system_charset_info,32,0,0,
(hash_get_key) tina_get_key,0,0);
+ tina_hton.state= SHOW_OPTION_YES;
+ tina_hton.db_type= DB_TYPE_CSV_DB;
+ tina_hton.create= tina_create_handler;
+ tina_hton.panic= tina_end;
+ tina_hton.flags= HTON_CAN_RECREATE;
}
return 0;
}
@@ -1401,14 +1368,16 @@ bool ha_tina::check_if_incompatible_data(HA_CREATE_INFO *info,
return COMPATIBLE_DATA_YES;
}
+struct st_mysql_storage_engine csv_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION, &tina_hton };
mysql_declare_plugin(csv)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
- &tina_hton,
- tina_hton_name,
+ &csv_storage_engine,
+ "CSV",
"Brian Aker, MySQL AB",
- tina_hton_comment,
+ "CSV storage engine",
tina_init_func, /* Plugin Init */
tina_done_func, /* Plugin Deinit */
0x0100 /* 1.0 */,
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index 2ce543dfbb0..28bccc7df2d 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -77,46 +77,7 @@ static int example_init_func();
static bool example_init_func_for_handlerton();
static int example_panic(enum ha_panic_function flag);
-static const char example_hton_name[]= "EXAMPLE";
-static const char example_hton_comment[]= "Example storage engine";
-
-handlerton example_hton= {
- MYSQL_HANDLERTON_INTERFACE_VERSION,
- example_hton_name,
- SHOW_OPTION_YES,
- example_hton_comment,
- DB_TYPE_EXAMPLE_DB,
- example_init_func_for_handlerton,
- 0, /* slot */
- 0, /* savepoint size. */
- NULL, /* close_connection */
- NULL, /* savepoint */
- NULL, /* rollback to savepoint */
- NULL, /* release savepoint */
- NULL, /* commit */
- NULL, /* rollback */
- NULL, /* prepare */
- NULL, /* recover */
- NULL, /* commit_by_xid */
- NULL, /* rollback_by_xid */
- NULL, /* create_cursor_read_view */
- NULL, /* set_cursor_read_view */
- NULL, /* close_cursor_read_view */
- example_create_handler, /* Create a new handler */
- NULL, /* Drop a database */
- example_panic, /* Panic call */
- NULL, /* Start Consistent Snapshot */
- NULL, /* Flush logs */
- NULL, /* Show status */
- NULL, /* Partition flags */
- NULL, /* Alter table flags */
- NULL, /* Alter tablespace */
- NULL, /* Fill Files table */
- HTON_CAN_RECREATE,
- NULL,
- NULL,
- NULL,
-};
+handlerton example_hton;
/* Variables for example share methods */
static HASH example_open_tables; // Hash used to track open tables
@@ -143,6 +104,11 @@ static int example_init_func()
VOID(pthread_mutex_init(&example_mutex,MY_MUTEX_INIT_FAST));
(void) hash_init(&example_open_tables,system_charset_info,32,0,0,
(hash_get_key) example_get_key,0,0);
+
+ example_hton.state= SHOW_OPTION_YES;
+ example_hton.db_type= DB_TYPE_EXAMPLE_DB;
+ example_hton.create= example_create_handler;
+ example_hton.flags= HTON_CAN_RECREATE;
}
DBUG_RETURN(0);
}
@@ -163,17 +129,6 @@ static int example_done_func()
DBUG_RETURN(0);
}
-static bool example_init_func_for_handlerton()
-{
- return example_init_func();
-}
-
-static int example_panic(enum ha_panic_function flag)
-{
- return example_done_func();
-}
-
-
/*
Example of simple lock controls. The "share" it creates is structure we will
pass to each example handler. Do you have to have one of these? Well, you have
@@ -741,18 +696,21 @@ int ha_example::create(const char *name, TABLE *table_arg,
HA_CREATE_INFO *create_info)
{
DBUG_ENTER("ha_example::create");
- /* This is not implemented but we want someone to be able that it works. */
+ /* This is not implemented but we want someone to be able to see that it works. */
DBUG_RETURN(0);
}
+struct st_mysql_storage_engine example_storage_engine=
+{ MYSQL_HANDLERTON_INTERFACE_VERSION, &example_hton };
+
mysql_declare_plugin(example)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
- &example_hton,
- example_hton_name,
+ &example_storage_engine,
+ "EXAMPLE",
"Brian Aker, MySQL AB",
- example_hton_comment,
+ "Example storage engine",
example_init_func, /* Plugin Init */
example_done_func, /* Plugin Deinit */
0x0001 /* 0.1 */,