Drizzled Public API Documentation

my_delete.cc

00001 /* Copyright (C) 2000 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 #include <config.h>
00017 
00018 #include <drizzled/internal/my_sys.h>
00019 #include <drizzled/error.h>
00020 
00021 namespace drizzled
00022 {
00023 namespace internal
00024 {
00025 
00026 int my_delete(const char *name, myf MyFlags)
00027 {
00028   int err;
00029 
00030   if ((err = unlink(name)) == -1)
00031   {
00032     errno=errno;
00033     if (MyFlags & (MY_FAE+MY_WME))
00034       my_error(EE_DELETE,MYF(ME_BELL+ME_WAITTANG+(MyFlags & ME_NOINPUT)),
00035          name,errno);
00036   }
00037   else if ((MyFlags & MY_SYNC_DIR) &&
00038            my_sync_dir_by_file(name, MyFlags))
00039     err= -1;
00040   return(err);
00041 } /* my_delete */
00042 
00043 } /* namespace internal */
00044 } /* namespace drizzled */