diff options
author | monty@hundin.mysql.fi <> | 2001-08-19 14:43:51 +0300 |
---|---|---|
committer | monty@hundin.mysql.fi <> | 2001-08-19 14:43:51 +0300 |
commit | a1be2a894f339f7b14a6b654c961d77ba13298d4 (patch) | |
tree | e2a8b10d8dae9fee5283beb230210199e135ef74 /heap/hp_create.c | |
parent | 1e1a1ec064de1f6ddbd0ae433b83d7c8647557a3 (diff) | |
download | mariadb-git-a1be2a894f339f7b14a6b654c961d77ba13298d4.tar.gz |
Fix of UNION code
Added heap_delete_table
Added HA_EXTRA_PREPARE_FOR_DELETE
Added and use my_dup() for faster open of tables.
Removed not working no-mix-table-type
Diffstat (limited to 'heap/hp_create.c')
-rw-r--r-- | heap/hp_create.c | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/heap/hp_create.c b/heap/hp_create.c index 01c5f43adfd..da91e412180 100644 --- a/heap/hp_create.c +++ b/heap/hp_create.c @@ -21,33 +21,49 @@ #include "heapdef.h" + int heap_create(const char *name) { + reg1 HP_SHARE *share; DBUG_ENTER("heap_create"); - (void) heap_delete_all(name); + pthread_mutex_lock(&THR_LOCK_heap); + if ((share=_hp_find_named_heap(name))) + { + if (share->open_count == 0) + _hp_free(share); + } + else + { + my_errno=ENOENT; + } + pthread_mutex_unlock(&THR_LOCK_heap); DBUG_RETURN(0); } -int heap_delete_all(const char *name) +int heap_delete_table(const char *name) { - reg1 HP_SHARE *info; - int found; - DBUG_ENTER("heap_delete_all"); + int result; + reg1 HP_SHARE *share; + DBUG_ENTER("heap_delete_table"); + pthread_mutex_lock(&THR_LOCK_heap); - if ((info=_hp_find_named_heap(name))) + if ((share=_hp_find_named_heap(name))) { - if (info->open_count == 0) - _hp_free(info); - found=0; + if (share->open_count == 0) + _hp_free(share); + else + share->delete_on_close=1; + result=0; } else { - found=my_errno=ENOENT; + result=my_errno=ENOENT; } pthread_mutex_unlock(&THR_LOCK_heap); - DBUG_RETURN(found); + DBUG_RETURN(result); } + void _hp_free(HP_SHARE *share) { heap_share_list=list_delete(heap_share_list,&share->open_list); |