Drizzled Public API Documentation

mi_rename.cc
00001 /* Copyright (C) 2000-2001, 2004 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 /*
00017   Rename a table
00018 */
00019 
00020 #include "myisam_priv.h"
00021 
00022 using namespace drizzled;
00023 
00024 int mi_rename(const char *old_name, const char *new_name)
00025 {
00026   char from[FN_REFLEN],to[FN_REFLEN];
00027 
00028   internal::fn_format(from,old_name,"",MI_NAME_IEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT);
00029   internal::fn_format(to,new_name,"",MI_NAME_IEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT);
00030   if (internal::my_rename_with_symlink(from, to, MYF(MY_WME)))
00031     return(errno);
00032   internal::fn_format(from,old_name,"",MI_NAME_DEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT);
00033   internal::fn_format(to,new_name,"",MI_NAME_DEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT);
00034   return(internal::my_rename_with_symlink(from, to,MYF(MY_WME)) ? errno : 0);
00035 }