List:Commits« Previous MessageNext Message »
From:Ramil Kalimullin Date:October 8 2008 4:00pm
Subject:bzr push into mysql-6.0 branch (ramil:2861 to 2863)
View as plain text  
 2863 Ramil Kalimullin	2008-10-08 [merge]
      Merge
modified:
  sql/handler.cc
  sql/handler.h

 2862 Ramil Kalimullin	2008-10-08
      Add cast to avoid warnings on some platforms.
modified:
  sql/mysql_priv.h

 2861 Mats Kindahl	2008-10-08
      (no message)
modified:
  sql/si_objects.cc
  sql/sql_class.h

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	2008-10-08 11:46:49 +0000
+++ b/sql/handler.cc	2008-10-08 13:55:20 +0000
@@ -2765,8 +2765,53 @@ bool handler::get_error_message(int erro
 }
 
 
+/**
+  Check for incompatible collation changes.
+   
+  @retval
+    HA_ADMIN_NEEDS_UPGRADE   Table may have data requiring upgrade.
+  @retval
+    0                        No upgrade required.
+*/
+
+int handler::check_collation_compatibility()
+{
+  ulong mysql_version= table->s->mysql_version;
+
+  if (mysql_version < 50048)
+  {
+    KEY *key= table->key_info;
+    KEY *key_end= key + table->s->keys;
+    for (; key < key_end; key++)
+    {
+      KEY_PART_INFO *key_part= key->key_part;
+      KEY_PART_INFO *key_part_end= key_part + key->key_parts;
+      for (; key_part < key_part_end; key_part++)
+      {
+        if (!key_part->fieldnr)
+          continue;
+        Field *field= table->field[key_part->fieldnr - 1];
+        uint cs_number= field->charset()->number;
+        if (mysql_version < 50048 &&
+            (cs_number == 11 || /* ascii_general_ci - bug #29499, bug #27562 */
+             cs_number == 41 || /* latin7_general_ci - bug #29461 */
+             cs_number == 42 || /* latin7_general_cs - bug #29461 */
+             cs_number == 20 || /* latin7_estonian_cs - bug #29461 */
+             cs_number == 21 || /* latin2_hungarian_ci - bug #29461 */
+             cs_number == 22 || /* koi8u_general_ci - bug #29461 */
+             cs_number == 23 || /* cp1251_ukrainian_ci - bug #29461 */
+             cs_number == 26))  /* cp1250_general_ci - bug #29461 */
+          return HA_ADMIN_NEEDS_UPGRADE;
+      }  
+    }  
+  }  
+  return 0;
+}
+
+
 int handler::ha_check_for_upgrade(HA_CHECK_OPT *check_opt)
 {
+  int error;
   KEY *keyinfo, *keyend;
   KEY_PART_INFO *keypart, *keypartend;
 
@@ -2795,6 +2840,10 @@ int handler::ha_check_for_upgrade(HA_CHE
   }
   if (table->s->frm_version != FRM_VER_TRUE_VARCHAR)
     return HA_ADMIN_NEEDS_ALTER;
+
+  if ((error= check_collation_compatibility()))
+    return error;
+    
   return check_for_upgrade(check_opt);
 }
 

=== modified file 'sql/handler.h'
--- a/sql/handler.h	2008-10-08 08:34:11 +0000
+++ b/sql/handler.h	2008-10-08 13:55:20 +0000
@@ -1542,6 +1542,7 @@ public:
   int ha_delete_row(const uchar * buf);
   void ha_release_auto_increment();
 
+  int check_collation_compatibility();
   int ha_check_for_upgrade(HA_CHECK_OPT *check_opt);
   /** to be actually called to get 'check()' functionality*/
   int ha_check(THD *thd, HA_CHECK_OPT *check_opt);

=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2008-10-07 17:04:28 +0000
+++ b/sql/mysql_priv.h	2008-10-08 13:54:30 +0000
@@ -140,7 +140,7 @@ char* query_table_status(THD *thd,const 
 #define WARN_DEPRECATED(Thd,VerHi,VerLo,Old,New)                            \
   do {                                                                      \
     compile_time_assert(MYSQL_VERSION_ID < VerHi * 10000 + VerLo * 100);    \
-    if ((Thd) != NULL)                                                      \
+    if (((THD *) Thd) != NULL)                                              \
       push_warning_printf((Thd), MYSQL_ERROR::WARN_LEVEL_WARN,              \
                         ER_WARN_DEPRECATED_SYNTAX,                          \
                         ER(ER_WARN_DEPRECATED_SYNTAX_WITH_VER),             \

Thread
bzr push into mysql-6.0 branch (ramil:2861 to 2863) Ramil Kalimullin8 Oct