List:Commits« Previous MessageNext Message »
From:Alexander Barkov Date:April 19 2012 10:50am
Subject:bzr push into mysql-trunk branch (alexander.barkov:3886 to 3887)
View as plain text  
 3887 Alexander Barkov	2012-04-19
      Changing data type of m_length in SimpleCString and descendants
      from uint to size_t, for better LEX_STRING compatibility.

    modified:
      sql/item.cc
      sql/item.h
      sql/item_func.cc
      sql/sql_show.cc
      sql/sql_show.h
      sql/sql_string.h
 3886 Mayank Prasad	2012-04-19 [merge]
      BUG#12427262 : 60961: SHOW TABLES VERY SLOW WHEN NOT IN SYSTEM DISK CACHE
            
      Details:
       - Merge : 5.5 -> trunk

    added:
      mysql-test/r/bug12427262.result
      mysql-test/t/bug12427262.test
    modified:
      sql/sql_show.cc
=== modified file 'sql/item.cc'
--- a/sql/item.cc	2012-04-17 14:37:50 +0000
+++ b/sql/item.cc	2012-04-19 10:49:27 +0000
@@ -961,7 +961,7 @@ bool Item::check_cols(uint c)
 const NameString null_name_string(NULL, 0);
 
 
-void NameString::copy(const char *str, uint length, const CHARSET_INFO *cs)
+void NameString::copy(const char *str, size_t length, const CHARSET_INFO *cs)
 {
   if (!length)
   {
@@ -997,7 +997,7 @@ void NameString::copy(const char *str, u
 }
 
 
-void ItemNameString::copy(const char *str_arg, uint length_arg,
+void ItemNameString::copy(const char *str_arg, size_t length_arg,
                           const CHARSET_INFO *cs_arg,
                           bool is_autogenerated_arg)
 {
@@ -1005,7 +1005,7 @@ void ItemNameString::copy(const char *st
   copy(str_arg, length_arg, cs_arg);
   if (length_arg > length() && !is_autogenerated())
   {
-    ErrConvString tmp(str_arg, length_arg, cs_arg);
+    ErrConvString tmp(str_arg, static_cast<uint>(length_arg), cs_arg);
     if (length() == 0)
       push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
                           ER_NAME_BECOMES_EMPTY, ER(ER_NAME_BECOMES_EMPTY),

=== modified file 'sql/item.h'
--- a/sql/item.h	2012-04-18 17:52:08 +0000
+++ b/sql/item.h	2012-04-19 10:49:27 +0000
@@ -170,10 +170,10 @@ public:
     It will involve hidden strlen() call, which can affect
     performance negatively. Use NameString(str, len) instead.
   */
-  NameString(const char *str, uint length):
+  NameString(const char *str, size_t length):
     SimpleCString(str, length) {}
   NameString(const LEX_STRING str): SimpleCString(str) {}
-  NameString(const char *str, uint length, bool is_null_terminated):
+  NameString(const char *str, size_t length, bool is_null_terminated):
     SimpleCString()
   {
     set_or_copy(str, length, is_null_terminated);
@@ -181,30 +181,30 @@ public:
   NameString(const LEX_STRING str, bool is_null_terminated):
     SimpleCString()
   {
-    set_or_copy(str.str, (uint) str.length, is_null_terminated);
+    set_or_copy(str.str, str.length, is_null_terminated);
   }
   /**
     Allocate space using sql_strmake() or sql_strmake_with_convert().
   */
-  void copy(const char *str, uint length, const CHARSET_INFO *cs);
+  void copy(const char *str, size_t length, const CHARSET_INFO *cs);
   /**
     Variants for copy(), for various argument combinations.
   */
-  void copy(const char *str, uint length)
+  void copy(const char *str, size_t length)
   {
     copy(str, length, system_charset_info);
   }
   void copy(const char *str)
   {
-    copy(str, (uint) (str ? strlen(str) : 0), system_charset_info);
+    copy(str, (str ? strlen(str) : 0), system_charset_info);
   }
   void copy(const LEX_STRING lex)
   {
-    copy(lex.str, (uint) lex.length);
+    copy(lex.str, lex.length);
   }
   void copy(const LEX_STRING *lex)
   {
-    copy(lex->str, (uint) lex->length);
+    copy(lex->str, lex->length);
   }
   void copy(const NameString str)
   {
@@ -273,7 +273,7 @@ public:
     Copy name together with autogenerated flag.
     Produce a warning if name was cut.
   */
-  void copy(const char *str_arg, uint length_arg, const CHARSET_INFO *cs_arg,
+  void copy(const char *str_arg, size_t length_arg, const CHARSET_INFO *cs_arg,
            bool is_autogenerated_arg);
 };
 
@@ -2797,7 +2797,7 @@ public:
   bool eq(const Item *item, bool binary_cmp) const;
   Item *clone_item() 
   {
-    return new Item_string((NameString) item_name, str_value.ptr(), 
+    return new Item_string(static_cast<NameString>(item_name), str_value.ptr(), 
     			   str_value.length(), collation.collation);
   }
   Item *safe_charset_converter(const CHARSET_INFO *tocs);
@@ -2899,7 +2899,7 @@ class Item_return_date_time :public Item
   enum_field_types date_time_field_type;
 public:
   Item_return_date_time(const char *name_arg, enum_field_types field_type_arg)
-    :Item_partition_func_safe_string(NameString((char *) name_arg, (uint) strlen(name_arg)),
+    :Item_partition_func_safe_string(NameString(name_arg, strlen(name_arg)),
                                      0, &my_charset_bin),
      date_time_field_type(field_type_arg)
   { decimals= 0; }
@@ -2911,7 +2911,7 @@ class Item_blob :public Item_partition_f
 {
 public:
   Item_blob(const char *name, uint length) :
-    Item_partition_func_safe_string(NameString((char *) name, (uint) strlen(name)),
+    Item_partition_func_safe_string(NameString(name, strlen(name)),
                                     length, &my_charset_bin)
   { }
   enum Type type() const { return TYPE_HOLDER; }
@@ -2930,7 +2930,7 @@ class Item_empty_string :public Item_par
 public:
   Item_empty_string(const char *header, uint length,
                     const CHARSET_INFO *cs= NULL) :
-    Item_partition_func_safe_string(NameString((char *)header, (uint) strlen(header)),
+    Item_partition_func_safe_string(NameString(header, strlen(header)),
                                     0, cs ? cs : &my_charset_utf8_general_ci)
     {
       max_length= length * collation.collation->mbmaxlen;
@@ -2945,7 +2945,7 @@ class Item_return_int :public Item_int
 public:
   Item_return_int(const char *name_arg, uint length,
 		  enum_field_types field_type_arg, longlong value= 0)
-    :Item_int(NameString(name_arg, name_arg ? (uint) strlen(name_arg) : 0),
+    :Item_int(NameString(name_arg, name_arg ? strlen(name_arg) : 0),
               value, length), int_field_type(field_type_arg)
   {
     unsigned_flag=1;

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2012-04-18 18:38:45 +0000
+++ b/sql/item_func.cc	2012-04-19 10:49:27 +0000
@@ -5760,7 +5760,7 @@ void Item_func_get_system_var::fix_lengt
 
 void Item_func_get_system_var::print(String *str, enum_query_type query_type)
 {
-  str->append(item_name.ptr(), item_name.length());
+  str->append(item_name);
 }
 
 

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2012-04-19 10:33:14 +0000
+++ b/sql/sql_show.cc	2012-04-19 10:49:27 +0000
@@ -6731,7 +6731,7 @@ TABLE *create_schema_table(THD *thd, TAB
     case MYSQL_TYPE_DOUBLE:
     {
       const NameString field_name(fields_info->field_name,
-                                  (uint) strlen(fields_info->field_name));
+                                  strlen(fields_info->field_name));
       if ((item= new Item_float(field_name, 0.0, NOT_FIXED_DEC, 
                                 fields_info->field_length)) == NULL)
         DBUG_RETURN(NULL);

=== modified file 'sql/sql_show.h'
--- a/sql/sql_show.h	2012-04-12 15:31:01 +0000
+++ b/sql/sql_show.h	2012-04-19 10:49:27 +0000
@@ -168,7 +168,7 @@ void append_identifier(THD *thd, String
 		       uint length);
 inline void append_identifier(THD *thd, String *packet, SimpleCString str)
 {
-  append_identifier(thd, packet, str.ptr(), str.length());
+  append_identifier(thd, packet, str.ptr(), static_cast<uint>(str.length()));
 }
 void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
 bool mysqld_show_create(THD *thd, TABLE_LIST *table_list);

=== modified file 'sql/sql_string.h'
--- a/sql/sql_string.h	2012-04-18 17:52:08 +0000
+++ b/sql/sql_string.h	2012-04-19 10:49:27 +0000
@@ -38,12 +38,12 @@ class SimpleCString
 {
 private:
   const char *m_str;
-  uint m_length;
+  size_t m_length;
 protected:
   /**
     Initialize from a C string whose length is already known.
   */
-  void set(const char *str_arg, uint length_arg)
+  void set(const char *str_arg, size_t length_arg)
   {
     // NULL is allowed only with length==0
     DBUG_ASSERT(str_arg || length_arg == 0);
@@ -57,13 +57,13 @@ public:
   {
     set(NULL, 0);
   }
-  SimpleCString(const char *str_arg, uint length_arg)
+  SimpleCString(const char *str_arg, size_t length_arg)
   {
     set(str_arg, length_arg);
   }
   SimpleCString(const LEX_STRING arg)
   {
-    set(arg.str, (uint) arg.length);
+    set(arg.str, arg.length);
   }
   void reset()
   {
@@ -74,7 +74,7 @@ public:
   */
   void set(const char *str)
   {
-    set(str, str ? (uint) strlen(str) : 0);
+    set(str, str ? strlen(str) : 0);
   }
   /**
     Return string buffer.
@@ -87,7 +87,7 @@ public:
   /**
     Return name length.
   */
-  uint length() const { return m_length; }
+  size_t length() const { return m_length; }
   /**
     Compare to another SimpleCString.
   */
@@ -377,7 +377,7 @@ public:
   }
   bool append(SimpleCString str)
   {
-    return append(str.ptr(), str.length());
+    return append(str.ptr(), static_cast<uint>(str.length()));
   }
   bool append(const char *s, uint32 arg_length);
   bool append(const char *s, uint32 arg_length, const CHARSET_INFO *cs);

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (alexander.barkov:3886 to 3887) Alexander Barkov20 Apr