home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 January / Chip_2001-01_cd1.bin / tema / mysql / mysql-3.23.28g-win-source.exe / myisam / mi_delete_table.c < prev    next >
C/C++ Source or Header  |  2000-08-31  |  2KB  |  61 lines

  1. /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
  2.    
  3.    This program is free software; you can redistribute it and/or modify
  4.    it under the terms of the GNU General Public License as published by
  5.    the Free Software Foundation; either version 2 of the License, or
  6.    (at your option) any later version.
  7.    
  8.    This program is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.    GNU General Public License for more details.
  12.    
  13.    You should have received a copy of the GNU General Public License
  14.    along with this program; if not, write to the Free Software
  15.    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
  16.  
  17. /*
  18.   deletes a table
  19. */
  20.  
  21. #include "fulltext.h"
  22. #ifdef    __WIN__
  23. #include <errno.h>
  24. #endif
  25.  
  26. int mi_delete_table(const char *name)
  27. {
  28.   char from[FN_REFLEN];
  29. #ifdef USE_RAID
  30.   uint raid_type=0,raid_chunks=0;
  31. #endif
  32.   DBUG_ENTER("mi_delete_table");
  33.  
  34. #ifdef EXTRA_DEBUG
  35.   check_table_is_closed(name,"delete");
  36. #endif
  37. #ifdef USE_RAID
  38.   {
  39.     MI_INFO *info;
  40.     if (!(info=mi_open(name, O_RDONLY, 0)))
  41.       DBUG_RETURN(my_errno);
  42.     raid_type =      info->s->base.raid_type;
  43.     raid_chunks =    info->s->base.raid_chunks;
  44.     mi_close(info);
  45.   }
  46. #ifdef EXTRA_DEBUG
  47.   check_table_is_closed(name,"delete");
  48. #endif
  49. #endif /* USE_RAID */
  50.  
  51.   fn_format(from,name,"",MI_NAME_IEXT,4);
  52.   if (my_delete(from, MYF(MY_WME)))
  53.     DBUG_RETURN(my_errno);
  54.   fn_format(from,name,"",MI_NAME_DEXT,4);
  55. #ifdef USE_RAID
  56.   if (raid_type)
  57.     DBUG_RETURN(my_raid_delete(from, raid_chunks, MYF(MY_WME)) ? my_errno : 0);
  58. #endif
  59.   DBUG_RETURN(my_delete(from, MYF(MY_WME)) ? my_errno : 0);
  60. }
  61.