Drizzled Public API Documentation

hp_close.cc
00001 /* Copyright (C) 2000-2002 MySQL AB
00002 
00003    This program is free software; you can redistribute it and/or modify
00004    it under the terms of the GNU General Public License as published by
00005    the Free Software Foundation; version 2 of the License.
00006 
00007    This program is distributed in the hope that it will be useful,
00008    but WITHOUT ANY WARRANTY; without even the implied warranty of
00009    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010    GNU General Public License for more details.
00011 
00012    You should have received a copy of the GNU General Public License
00013    along with this program; if not, write to the Free Software
00014    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00015 
00016 /* close a heap-database */
00017 
00018 #include "heap_priv.h"
00019 #include <cstdlib>
00020 
00021 using namespace std;
00022 
00023   /* Close a database open by hp_open() */
00024   /* Data is normally not deallocated */
00025 
00026 int heap_close(HP_INFO *info)
00027 {
00028   int tmp;
00029   THR_LOCK_heap.lock();
00030   tmp= hp_close(info);
00031   THR_LOCK_heap.unlock();
00032 
00033   return(tmp);
00034 }
00035 
00036 
00037 int hp_close(HP_INFO *info)
00038 {
00039   int error=0;
00040   info->getShare()->changed=0;
00041   heap_open_list.remove(info);
00042   if (!--info->getShare()->open_count && info->getShare()->delete_on_close)
00043     hp_free(info->getShare());        /* Table was deleted */
00044   delete info;
00045   return(error);
00046 }