List:Commits« Previous MessageNext Message »
From:bar Date:December 31 2005 8:34am
Subject:bk commit into 5.1 tree (bar:1.2015)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of bar. When bar does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2015 05/12/31 12:34:39 bar@stripped +4 -0
    Making old tables seen with "#mysql50#" prefix,
    which makes it possible to run RENAME TABLE
    on old tables when upgrading from 5.0.
    TODO: A stored procedure to rename all tables and
    databases with old name format into new format,
    it will simplify upgrade.
  sql_table.cc:
    Making old tables seen with "#mysql50#" prefix.
    Adding warning into .err log when an old name is found.
  sql_show.cc:
    Skip non-directories before filename_to_tablename
    call, to avoid unnecessary warnings.
  strfunc.cc:
    Adding "error" argument to strconvert()
  mysql_priv.h:
    Adding "error" agrument to strconvert()

  sql/sql_table.cc
    1.290 05/12/31 12:28:24 bar@stripped +32 -0
    Making old tables seen with "#mysql50#" prefix,
    which makes it possible to run RENAME TABLE
    on old tables.
    Adding warning into .err log when an old name is found.

  sql/sql_show.cc
    1.294 05/12/31 12:26:17 bar@stripped +3 -2
    Skip non-directories before filename_to_tablename
    call, to avoid warning.

  sql/strfunc.cc
    1.11 05/12/31 12:23:53 bar@stripped +2 -1
    Adding "error" argument to strconvert()

  sql/mysql_priv.h
    1.362 05/12/31 12:23:08 bar@stripped +3 -12
    Adding "error" agrument to strconvert()

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	bar
# Host:	bar.intranet.mysql.r18.ru
# Root:	/usr/home/bar/mysql-5.1-new.fscs3

--- 1.361/sql/mysql_priv.h	2005-12-31 08:57:36 +04:00
+++ 1.362/sql/mysql_priv.h	2005-12-31 12:23:08 +04:00
@@ -1504,20 +1504,11 @@
 
 /* Conversion functions */
 uint strconvert(CHARSET_INFO *from_cs, const char *from,
-                CHARSET_INFO *to_cs, char *to, uint to_length);
+                CHARSET_INFO *to_cs, char *to, uint to_length, uint *errors);
+uint filename_to_tablename(const char *from, char *to, uint to_length);
+uint tablename_to_filename(const char *from, char *to, uint to_length);
 uint build_table_filename(char *buff, size_t bufflen, const char *db,
                           const char *table, const char *ext);
-inline uint filename_to_tablename(const char *from, char *to, uint to_length)
-{
-  return strconvert(&my_charset_filename, from,
-                    system_charset_info, to, to_length);
-}
-inline uint tablename_to_filename(const char *from, char *to, uint to_length)
-{
-  return strconvert(system_charset_info, from,
-                    &my_charset_filename, to, to_length);
-}
-
 /* from hostname.cc */
 struct in_addr;
 my_string ip_to_hostname(struct in_addr *in,uint *errors);

--- 1.293/sql/sql_show.cc	2005-12-31 08:54:38 +04:00
+++ 1.294/sql/sql_show.cc	2005-12-31 12:26:17 +04:00
@@ -437,9 +437,10 @@
                continue;
        }
 #endif
+      if (!MY_S_ISDIR(file->mystat->st_mode))
+        continue;
       VOID(filename_to_tablename(file->name, uname, sizeof(uname)));
-      if (!MY_S_ISDIR(file->mystat->st_mode) ||
-          (wild && wild_compare(uname, wild, 0)))
+      if (wild && wild_compare(uname, wild, 0))
         continue;
       file->name= uname;
     }

--- 1.289/sql/sql_table.cc	2005-12-31 08:54:40 +04:00
+++ 1.290/sql/sql_table.cc	2005-12-31 12:28:24 +04:00
@@ -102,6 +102,38 @@
   DBUG_RETURN(FALSE);
 }
 
+
+#define MYSQL50_TABLE_NAME_PREFIX         "#mysql50#"
+#define MYSQL50_TABLE_NAME_PREFIX_LENGTH  9
+
+uint filename_to_tablename(const char *from, char *to, uint to_length)
+{
+  uint errors, res= strconvert(&my_charset_filename, from,
+                               system_charset_info,  to, to_length, &errors);
+  if (errors) // Old 5.0 name
+  {
+    res= strxnmov(to, to_length, MYSQL50_TABLE_NAME_PREFIX,  from, NullS) - to;
+    sql_print_error("Invalid (old?) table or database name '%s'", from);
+    /*
+      TODO: add a stored procedure for fix table and database names,
+      and mention its name in error log.
+    */
+  }
+  return res;
+}
+
+
+uint tablename_to_filename(const char *from, char *to, uint to_length)
+{
+  uint errors;
+  if (from[0] && !strncmp(from, MYSQL50_TABLE_NAME_PREFIX,
+                          MYSQL50_TABLE_NAME_PREFIX_LENGTH))
+    return my_snprintf(to, to_length, "%s", from + 9);
+  return strconvert(system_charset_info, from,
+                    &my_charset_filename, to, to_length, &errors);
+}
+
+
 /*
   Creates path to a file: mysql_data_dir/db/table.ext
 

--- 1.10/sql/strfunc.cc	2005-12-31 08:54:46 +04:00
+++ 1.11/sql/strfunc.cc	2005-12-31 12:23:53 +04:00
@@ -258,7 +258,7 @@
 
 
 uint strconvert(CHARSET_INFO *from_cs, const char *from,
-                CHARSET_INFO *to_cs, char *to, uint to_length)
+                CHARSET_INFO *to_cs, char *to, uint to_length, uint *errors)
 {
   int cnvres;
   my_wc_t wc;
@@ -308,6 +308,7 @@
       break;
   }
   *to= '\0';
+  *errors= error_count;
   return (uint32) (to - to_start);
 
 }
Thread
bk commit into 5.1 tree (bar:1.2015)bar31 Dec