summaryrefslogtreecommitdiff
path: root/storage/csv
diff options
context:
space:
mode:
authorunknown <brian@zim.(none)>2006-11-19 18:01:54 -0800
committerunknown <brian@zim.(none)>2006-11-19 18:01:54 -0800
commit7d6b4a1ab06b22505a68334aeae0204cf0e4bb7a (patch)
tree5a1d28bf16e44e62244be8effd391e8ebe3c51bc /storage/csv
parent3e0eee1d7b530df3d4685acea74d1a8bb139e558 (diff)
downloadmariadb-git-7d6b4a1ab06b22505a68334aeae0204cf0e4bb7a.tar.gz
Refactored a number of engines to have correct init/deinit. Added pass support for "data" from plugin to plugin generic init to use memory location.
plugin/daemon_example/plug.in: Switched the plug.in type (corrected) sql/handler.h: Added data pointer to use for engines. sql/sql_plugin.cc: Passing plugin to generic handlers to allow them to add data to "data" storage/archive/ha_archive.cc: Refactored. Now uses less logic for startup/shutdown. storage/csv/ha_tina.cc: Refactored init/deinit to use less code. storage/example/ha_example.cc: Refactored example to show correct behavior for init/deinit. storage/example/ha_example.h: Removed unneeded references to methods that do not need to be implemened. storage/federated/ha_federated.cc: Refactored to use less code and startup/shutdown correctly.
Diffstat (limited to 'storage/csv')
-rw-r--r--storage/csv/ha_tina.cc46
1 files changed, 12 insertions, 34 deletions
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index f7e5aa9d50c..7051bd41cb1 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -73,11 +73,9 @@ static int write_meta_file(File meta_file, ha_rows rows, bool dirty);
/* Stuff for shares */
pthread_mutex_t tina_mutex;
static HASH tina_open_tables;
-static int tina_init= 0;
static handler *tina_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root);
-int tina_end(handlerton *hton, ha_panic_function type);
off_t Transparent_file::read_next()
@@ -155,35 +153,23 @@ static int tina_init_func(void *p)
{
handlerton *tina_hton;
- if (!tina_init)
- {
- tina_hton= (handlerton *)p;
- tina_init++;
- 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 | HTON_SUPPORT_LOG_TABLES |
- HTON_NO_PARTITION);
- }
+ tina_hton= (handlerton *)p;
+ 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->flags= (HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES |
+ HTON_NO_PARTITION);
return 0;
}
static int tina_done_func(void *p)
{
- if (tina_init)
- {
- if (tina_open_tables.records)
- {
- return 1;
- }
- hash_free(&tina_open_tables);
- pthread_mutex_destroy(&tina_mutex);
- tina_init--;
- }
+ hash_free(&tina_open_tables);
+ pthread_mutex_destroy(&tina_mutex);
+
return 0;
}
@@ -199,9 +185,6 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table)
char *tmp_name;
uint length;
- if (!tina_init)
- tina_init_func(NULL);
-
pthread_mutex_lock(&tina_mutex);
length=(uint) strlen(table_name);
@@ -455,11 +438,6 @@ static int free_share(TINA_SHARE *share)
DBUG_RETURN(result_code);
}
-int tina_end(handlerton *hton, ha_panic_function type)
-{
- return tina_done_func(NULL);
-}
-
/*
This function finds the end of a line and returns the length