summaryrefslogtreecommitdiff
path: root/sql/parse_file.cc
diff options
context:
space:
mode:
authorunknown <bar@mysql.com/bar.intranet.mysql.r18.ru>2006-10-16 22:42:03 +0500
committerunknown <bar@mysql.com/bar.intranet.mysql.r18.ru>2006-10-16 22:42:03 +0500
commit81eb1ccda26658d4cae69cc396413bb2819221ff (patch)
tree9faae5eba644979834b8ee8f48055486da6d514a /sql/parse_file.cc
parent27bbf36f87138ee434f629756a543fa7caf9f789 (diff)
downloadmariadb-git-81eb1ccda26658d4cae69cc396413bb2819221ff.tar.gz
Bug#21370: View renaming lacks tablename_to_filename encoding
Problem: renaming of FRM file and ARC files didn't use file name encoding, so RENAME TABLE for views failed for views having "tricky" characters in their names. Fix: adding build_table_filename() in missing places. mysql-test/r/view.result: Adding test case mysql-test/t/view.test: Adding test case sql/parse_file.cc: Adding build_table_filename() sql/sql_view.cc: Adding build_table_filename()
Diffstat (limited to 'sql/parse_file.cc')
-rw-r--r--sql/parse_file.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/sql/parse_file.cc b/sql/parse_file.cc
index 0071d59242e..0a2d4012af4 100644
--- a/sql/parse_file.cc
+++ b/sql/parse_file.cc
@@ -368,32 +368,33 @@ my_bool rename_in_schema_file(const char *schema, const char *old_name,
{
char old_path[FN_REFLEN], new_path[FN_REFLEN], arc_path[FN_REFLEN];
- strxnmov(old_path, FN_REFLEN-1, mysql_data_home, "/", schema, "/",
- old_name, reg_ext, NullS);
- (void) unpack_filename(old_path, old_path);
-
- strxnmov(new_path, FN_REFLEN-1, mysql_data_home, "/", schema, "/",
- new_name, reg_ext, NullS);
- (void) unpack_filename(new_path, new_path);
+ build_table_filename(old_path, sizeof(old_path) - 1,
+ schema, old_name, reg_ext, 0);
+ build_table_filename(new_path, sizeof(new_path) - 1,
+ schema, new_name, reg_ext, 0);
if (my_rename(old_path, new_path, MYF(MY_WME)))
return 1;
/* check if arc_dir exists */
- strxnmov(arc_path, FN_REFLEN-1, mysql_data_home, "/", schema, "/arc", NullS);
- (void) unpack_filename(arc_path, arc_path);
+ build_table_filename(arc_path, sizeof(arc_path) - 1, schema, "arc", "", 0);
if (revision > 0 && !access(arc_path, F_OK))
{
+ char old_name_buf[FN_REFLEN], new_name_buf[FN_REFLEN];
ulonglong limit= ((revision > num_view_backups) ?
revision - num_view_backups : 0);
+
+ VOID(tablename_to_filename(old_name, old_name_buf, sizeof(old_name_buf)));
+ VOID(tablename_to_filename(new_name, new_name_buf, sizeof(new_name_buf)));
+
for (; revision > limit ; revision--)
{
my_snprintf(old_path, FN_REFLEN, "%s/%s%s-%04lu",
- arc_path, old_name, reg_ext, (ulong)revision);
+ arc_path, old_name_buf, reg_ext, (ulong) revision);
(void) unpack_filename(old_path, old_path);
my_snprintf(new_path, FN_REFLEN, "%s/%s%s-%04lu",
- arc_path, new_name, reg_ext, (ulong)revision);
+ arc_path, new_name_buf, reg_ext, (ulong) revision);
(void) unpack_filename(new_path, new_path);
my_rename(old_path, new_path, MYF(0));
}