From 1abab6c7c7461bac95afd424e80b9a953fdf897b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Jul 2007 10:49:54 +0300 Subject: Bug #29325: By default MyISAM overwrites .MYD and .MYI files no DATA DIRECTORY option is used. This can lead to two tables using the same .MYD and .MYI files (that can't be dropped). To prevent CREATE TABLE from overwriting a file a new option is introduced : keep_files_on_create When this is on the CREATE TABLE throws an error if either the .MYD or .MYI exists for a MyISAM table. The option is off by default (resulting in compatible behavior). include/my_base.h: Bug #29325: introduce keep_files_on_create myisam/mi_create.c: Bug #29325: introduce keep_files_on_create mysql-test/r/create.result: Bug #29325: test case mysql-test/t/create.test: Bug #29325: test case sql/ha_myisam.cc: Bug #29325: introduce keep_files_on_create sql/set_var.cc: Bug #29325: introduce keep_files_on_create sql/sql_class.h: Bug #29325: introduce keep_files_on_create sql/sql_table.cc: Bug #29325: introduce keep_files_on_create sql/unireg.cc: Bug #29325: introduce keep_files_on_create --- myisam/mi_create.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'myisam') diff --git a/myisam/mi_create.c b/myisam/mi_create.c index ea1d8c7b83e..dd8a5b0d525 100644 --- a/myisam/mi_create.c +++ b/myisam/mi_create.c @@ -586,7 +586,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, 32 : 0)); linkname_ptr=0; /* Replace the current file */ - create_flag=MY_DELETE_OLD; + if (!(flags & HA_CREATE_KEEP_FILES)) + create_flag=MY_DELETE_OLD; } /* @@ -647,7 +648,8 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, { fn_format(filename,name,"",MI_NAME_DEXT,4); linkname_ptr=0; - create_flag=MY_DELETE_OLD; + if (!(flags & HA_CREATE_KEEP_FILES)) + create_flag=MY_DELETE_OLD; } if ((dfile= my_create_with_symlink(linkname_ptr, filename, 0, create_mode, -- cgit v1.2.1