summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2006-01-24 17:46:13 +0100
committerunknown <msvensson@neptunus.(none)>2006-01-24 17:46:13 +0100
commita2f192f1ef87689a7044a714bab39e4fce109036 (patch)
treedd3ab4facce9d819cbf9f8cb47c286ef3ce82da8 /sql/table.cc
parent464ec791e7702dab528229d47f28c7ae3ea4bdfd (diff)
parent8e35b68336848f655b7943e73b3647feb54f40a0 (diff)
downloadmariadb-git-a2f192f1ef87689a7044a714bab39e4fce109036.tar.gz
Merge bk-internal:/home/bk/mysql-5.1-new
into neptunus.(none):/home/msvensson/mysql/bug15020/my51-bug15020 sql/table.cc: Auto merged
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 2a11326494b..b912683d371 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -270,7 +270,32 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags)
strxmov(path, share->normalized_path.str, reg_ext, NullS);
if ((file= my_open(path, O_RDONLY | O_SHARE, MYF(0))) < 0)
- goto err_not_open;
+ {
+ /* Try unecoded 5.0 name */
+ uint length;
+ strxnmov(path, sizeof(path)-1,
+ mysql_data_home, "/", share->db.str, "/",
+ share->table_name.str, reg_ext, NullS);
+ length= unpack_filename(path, path) - reg_ext_length;
+ /*
+ The following is a safety test and should never fail
+ as the old file name should never be longer than the new one.
+ */
+ DBUG_ASSERT(length <= share->normalized_path.length);
+ /*
+ If the old and the new names have the same length,
+ then table name does not have tricky characters,
+ so no need to check the old file name.
+ */
+ if (length == share->normalized_path.length ||
+ ((file= my_open(path, O_RDONLY | O_SHARE, MYF(0))) < 0))
+ goto err_not_open;
+
+ /* Unencoded 5.0 table name found */
+ path[length]= '\0'; // Remove .frm extension
+ strmov(share->normalized_path.str, path);
+ share->normalized_path.length= length;
+ }
error= 4;
if (my_read(file,(byte*) head, 64, MYF(MY_NABP)))