summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@magare.gmz>2007-07-11 10:49:54 +0300
committerunknown <gkodinov/kgeorge@magare.gmz>2007-07-11 10:49:54 +0300
commit1abab6c7c7461bac95afd424e80b9a953fdf897b (patch)
treeada188315b9dd58d074fb0ee2259aa3dd1c205d7 /myisam
parent8195a213c2fadfb185e755ce6dda2162df1a5529 (diff)
downloadmariadb-git-1abab6c7c7461bac95afd424e80b9a953fdf897b.tar.gz
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
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_create.c6
1 files changed, 4 insertions, 2 deletions
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,