List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:March 9 2007 6:05am
Subject:bk commit into 5.0 tree (anozdrin:1.2446)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of alik. When alik 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@stripped, 2007-03-09 08:05:08+03:00, anozdrin@stripped +13 -0
  Polishing: use constants instead of magic numbers.

  include/my_global.h@stripped, 2007-03-09 08:05:04+03:00, anozdrin@stripped +9 -0
    Introduce constants to be used instead of magic numbers.

  sql/field.cc@stripped, 2007-03-09 08:05:05+03:00, anozdrin@stripped +3 -3
    Polishing: use contants instead of magic numbers.

  sql/ha_innodb.cc@stripped, 2007-03-09 08:05:05+03:00, anozdrin@stripped +8 -8
    Polishing: use contants instead of magic numbers.

  sql/handler.cc@stripped, 2007-03-09 08:05:05+03:00, anozdrin@stripped +3 -3
    Polishing: use contants instead of magic numbers.

  sql/item.cc@stripped, 2007-03-09 08:05:05+03:00, anozdrin@stripped +3 -3
    Polishing: use contants instead of magic numbers.

  sql/item.h@stripped, 2007-03-09 08:05:05+03:00, anozdrin@stripped +6 -3
    Polishing: use contants instead of magic numbers.

  sql/item_func.cc@stripped, 2007-03-09 08:05:05+03:00, anozdrin@stripped +3 -2
    Polishing: use contants instead of magic numbers.

  sql/item_subselect.cc@stripped, 2007-03-09 08:05:05+03:00, anozdrin@stripped +2 -1
    Polishing: use contants instead of magic numbers.

  sql/log_event.cc@stripped, 2007-03-09 08:05:05+03:00, anozdrin@stripped +3 -2
    Polishing: use contants instead of magic numbers.

  sql/sql_base.cc@stripped, 2007-03-09 08:05:05+03:00, anozdrin@stripped +2 -1
    Polishing: use contants instead of magic numbers.

  sql/sql_select.cc@stripped, 2007-03-09 08:05:05+03:00, anozdrin@stripped +3 -3
    Polishing: use contants instead of magic numbers.

  sql/sql_show.cc@stripped, 2007-03-09 08:05:05+03:00, anozdrin@stripped +25 -18
    Polishing: use contants instead of magic numbers.

  sql/sql_table.cc@stripped, 2007-03-09 08:05:05+03:00, anozdrin@stripped +2 -1
    Polishing: use contants instead of magic numbers.

# 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:	anozdrin
# Host:	booka.opbmk
# Root:	/home/alik/Documents/MySQL/devel/5.0-rt-polishing

--- 1.341/sql/field.cc	2007-03-01 13:37:23 +03:00
+++ 1.342/sql/field.cc	2007-03-09 08:05:05 +03:00
@@ -1203,12 +1203,12 @@
 String *Field::val_int_as_str(String *val_buffer, my_bool unsigned_val)
 {
   CHARSET_INFO *cs= &my_charset_bin;
-  uint length= 21;
+  uint length;
   longlong value= val_int();
-  if (val_buffer->alloc(length))
+  if (val_buffer->alloc(MY_INT64_NUM_DECIMAL_DIGITS))
     return 0;
   length= (uint) (*cs->cset->longlong10_to_str)(cs, (char*) val_buffer->ptr(),
-                                                length,
+                                                MY_INT64_NUM_DECIMAL_DIGITS,
                                                 unsigned_val ? 10 : -10,
                                                 value);
   val_buffer->length(length);

--- 1.228/sql/handler.cc	2007-02-21 14:04:59 +03:00
+++ 1.229/sql/handler.cc	2007-03-09 08:05:05 +03:00
@@ -1082,9 +1082,9 @@
   XID_STATE *xs;
   DBUG_ENTER("mysql_xa_recover");
 
-  field_list.push_back(new Item_int("formatID",0,11));
-  field_list.push_back(new Item_int("gtrid_length",0,11));
-  field_list.push_back(new Item_int("bqual_length",0,11));
+  field_list.push_back(new Item_int("formatID", 0, MY_INT32_NUM_DECIMAL_DIGITS));
+  field_list.push_back(new Item_int("gtrid_length", 0, MY_INT32_NUM_DECIMAL_DIGITS));
+  field_list.push_back(new Item_int("bqual_length", 0, MY_INT32_NUM_DECIMAL_DIGITS));
   field_list.push_back(new Item_empty_string("data",XIDDATASIZE));
 
   if (protocol->send_fields(&field_list,

--- 1.251/sql/item.cc	2007-02-26 15:57:41 +03:00
+++ 1.252/sql/item.cc	2007-03-09 08:05:05 +03:00
@@ -148,7 +148,7 @@
 Hybrid_type_traits_integer::fix_length_and_dec(Item *item, Item *arg) const
 {
   item->decimals= 0;
-  item->max_length= 21;
+  item->max_length= MY_INT64_NUM_DECIMAL_DIGITS;
   item->unsigned_flag= 0;
 }
 
@@ -2491,7 +2491,7 @@
       item_result_type= REAL_RESULT;
       break;
     case INT_RESULT:
-      set_int(*(longlong*)entry->value, 21);
+      set_int(*(longlong*)entry->value, MY_INT64_NUM_DECIMAL_DIGITS);
       item_type= Item::INT_ITEM;
       item_result_type= INT_RESULT;
       break;
@@ -6535,7 +6535,7 @@
   case MYSQL_TYPE_SHORT:
     return 6;
   case MYSQL_TYPE_LONG:
-    return 11;
+    return MY_INT32_NUM_DECIMAL_DIGITS;
   case MYSQL_TYPE_FLOAT:
     return 25;
   case MYSQL_TYPE_DOUBLE:

--- 1.218/sql/item.h	2007-02-26 15:57:41 +03:00
+++ 1.219/sql/item.h	2007-03-09 08:05:05 +03:00
@@ -1494,11 +1494,14 @@
 {
 public:
   longlong value;
-  Item_int(int32 i,uint length=11) :value((longlong) i)
+  Item_int(int32 i,uint length= MY_INT32_NUM_DECIMAL_DIGITS)
+    :value((longlong) i)
     { max_length=length; fixed= 1; }
-  Item_int(longlong i,uint length=21) :value(i)
+  Item_int(longlong i,uint length= MY_INT64_NUM_DECIMAL_DIGITS)
+    :value(i)
     { max_length=length; fixed= 1; }
-  Item_int(ulonglong i, uint length= 21) :value((longlong)i)
+  Item_int(ulonglong i, uint length= MY_INT64_NUM_DECIMAL_DIGITS)
+    :value((longlong)i)
     { max_length=length; fixed= 1; unsigned_flag= 1; }
   Item_int(const char *str_arg,longlong i,uint length) :value(i)
     { max_length=length; name=(char*) str_arg; fixed= 1; }

--- 1.326/sql/item_func.cc	2007-03-02 06:08:54 +03:00
+++ 1.327/sql/item_func.cc	2007-03-09 08:05:05 +03:00
@@ -426,7 +426,7 @@
 
   switch (result_type()) {
   case INT_RESULT:
-    if (max_length > 11)
+    if (max_length > MY_INT32_NUM_DECIMAL_DIGITS)
       res= new Field_longlong(max_length, maybe_null, name, t_arg,
 			      unsigned_flag);
     else
@@ -2316,7 +2316,8 @@
 
 void Item_func_locate::fix_length_and_dec()
 {
-  maybe_null=0; max_length=11;
+  maybe_null= 0;
+  max_length= MY_INT32_NUM_DECIMAL_DIGITS;
   agg_arg_charsets(cmp_collation, args, 2, MY_COLL_CMP_CONV, 1);
 }
 

--- 1.228/sql/log_event.cc	2007-03-07 12:24:41 +03:00
+++ 1.229/sql/log_event.cc	2007-03-09 08:05:05 +03:00
@@ -541,12 +541,13 @@
 void Log_event::init_show_field_list(List<Item>* field_list)
 {
   field_list->push_back(new Item_empty_string("Log_name", 20));
-  field_list->push_back(new Item_return_int("Pos", 11,
+  field_list->push_back(new Item_return_int("Pos", MY_INT32_NUM_DECIMAL_DIGITS,
 					    MYSQL_TYPE_LONGLONG));
   field_list->push_back(new Item_empty_string("Event_type", 20));
   field_list->push_back(new Item_return_int("Server_id", 10,
 					    MYSQL_TYPE_LONG));
-  field_list->push_back(new Item_return_int("End_log_pos", 11,
+  field_list->push_back(new Item_return_int("End_log_pos",
+                                            MY_INT32_NUM_DECIMAL_DIGITS,
 					    MYSQL_TYPE_LONGLONG));
   field_list->push_back(new Item_empty_string("Info", 20));
 }

--- 1.369/sql/sql_base.cc	2007-03-06 21:30:06 +03:00
+++ 1.370/sql/sql_base.cc	2007-03-09 08:05:05 +03:00
@@ -4559,7 +4559,8 @@
 
           Item_int do not need fix_fields() because it is basic constant.
         */
-        it.replace(new Item_int("Not_used", (longlong) 1, 21));
+        it.replace(new Item_int("Not_used", (longlong) 1,
+                                MY_INT64_NUM_DECIMAL_DIGITS));
       }
       else if (insert_fields(thd, ((Item_field*) item)->context,
                              ((Item_field*) item)->db_name,

--- 1.496/sql/sql_select.cc	2007-03-08 15:13:01 +03:00
+++ 1.497/sql/sql_select.cc	2007-03-09 08:05:05 +03:00
@@ -8491,7 +8491,7 @@
 	if ((new_cond= new Item_func_eq(args[0],
 					new Item_int("last_insert_id()",
 						     thd->current_insert_id,
-						     21))))
+						     MY_INT64_NUM_DECIMAL_DIGITS))))
 	{
           /*
             Set THD::last_insert_id_used_bin_log manually, as this
@@ -8757,7 +8757,7 @@
     break;
   case INT_RESULT:
     /* Select an integer type with the minimal fit precision */
-    if (item->max_length > 11)
+    if (item->max_length > MY_INT32_NUM_DECIMAL_DIGITS)
       new_field=new Field_longlong(item->max_length, maybe_null,
                                    item->name, table, item->unsigned_flag);
     else
@@ -14964,7 +14964,7 @@
       /* Add "rows" field to item_list. */
       item_list.push_back(new Item_int((longlong) (ulonglong)
 				       join->best_positions[i]. records_read,
-				       21));
+				       MY_INT64_NUM_DECIMAL_DIGITS));
       /* Build "Extra" field and add it to item_list. */
       my_bool key_read=table->key_read;
       if ((tab->type == JT_NEXT || tab->type == JT_CONST) &&

--- 1.341/sql/sql_show.cc	2007-02-22 17:59:55 +03:00
+++ 1.342/sql/sql_show.cc	2007-03-09 08:05:05 +03:00
@@ -205,7 +205,8 @@
   DBUG_ENTER("mysqld_show_column_types");
 
   field_list.push_back(new Item_empty_string("Type",30));
-  field_list.push_back(new Item_int("Size",(longlong) 1,21));
+  field_list.push_back(new Item_int("Size",(longlong) 1,
+                                    MY_INT64_NUM_DECIMAL_DIGITS));
   field_list.push_back(new Item_empty_string("Min_Value",20));
   field_list.push_back(new Item_empty_string("Max_Value",20));
   field_list.push_back(new Item_return_int("Prec", 4, MYSQL_TYPE_SHORT));
@@ -1284,7 +1285,7 @@
   Protocol *protocol= thd->protocol;
   DBUG_ENTER("mysqld_list_processes");
 
-  field_list.push_back(new Item_int("Id",0,11));
+  field_list.push_back(new Item_int("Id", 0, MY_INT32_NUM_DECIMAL_DIGITS));
   field_list.push_back(new Item_empty_string("User",16));
   field_list.push_back(new Item_empty_string("Host",LIST_PROCESS_HOST_LEN));
   field_list.push_back(field=new Item_empty_string("db",NAME_LEN));
@@ -4038,20 +4039,25 @@
   {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Name"},
   {"TABLE_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
   {"ENGINE", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, "Engine"},
-  {"VERSION", 21 , MYSQL_TYPE_LONG, 0, 1, "Version"},
+  {"VERSION", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONG, 0, 1, "Version"},
   {"ROW_FORMAT", 10, MYSQL_TYPE_STRING, 0, 1, "Row_format"},
-  {"TABLE_ROWS", 21 , MYSQL_TYPE_LONG, 0, 1, "Rows"},
-  {"AVG_ROW_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Avg_row_length"},
-  {"DATA_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Data_length"},
-  {"MAX_DATA_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Max_data_length"},
-  {"INDEX_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Index_length"},
-  {"DATA_FREE", 21 , MYSQL_TYPE_LONG, 0, 1, "Data_free"},
-  {"AUTO_INCREMENT", 21 , MYSQL_TYPE_LONG, 0, 1, "Auto_increment"},
+  {"TABLE_ROWS", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONG, 0, 1, "Rows"},
+  {"AVG_ROW_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONG, 0, 1,
+   "Avg_row_length"},
+  {"DATA_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONG, 0, 1,
+   "Data_length"},
+  {"MAX_DATA_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONG, 0, 1,
+   "Max_data_length"},
+  {"INDEX_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONG, 0, 1,
+   "Index_length"},
+  {"DATA_FREE", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONG, 0, 1, "Data_free"},
+  {"AUTO_INCREMENT", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONG, 0, 1,
+   "Auto_increment"},
   {"CREATE_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Create_time"},
   {"UPDATE_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Update_time"},
   {"CHECK_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Check_time"},
   {"TABLE_COLLATION", 64, MYSQL_TYPE_STRING, 0, 1, "Collation"},
-  {"CHECKSUM", 21 , MYSQL_TYPE_LONG, 0, 1, "Checksum"},
+  {"CHECKSUM", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONG, 0, 1, "Checksum"},
   {"CREATE_OPTIONS", 255, MYSQL_TYPE_STRING, 0, 1, "Create_options"},
   {"TABLE_COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, "Comment"},
   {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
@@ -4064,14 +4070,15 @@
   {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
   {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
   {"COLUMN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Field"},
-  {"ORDINAL_POSITION", 21 , MYSQL_TYPE_LONG, 0, 0, 0},
+  {"ORDINAL_POSITION", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONG, 0, 0, 0},
   {"COLUMN_DEFAULT", MAX_FIELD_VARCHARLENGTH, MYSQL_TYPE_STRING, 0, 1, "Default"},
   {"IS_NULLABLE", 3, MYSQL_TYPE_STRING, 0, 0, "Null"},
   {"DATA_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
-  {"CHARACTER_MAXIMUM_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, 0},
-  {"CHARACTER_OCTET_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, 0},
-  {"NUMERIC_PRECISION", 21 , MYSQL_TYPE_LONG, 0, 1, 0},
-  {"NUMERIC_SCALE", 21 , MYSQL_TYPE_LONG, 0, 1, 0},
+  {"CHARACTER_MAXIMUM_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONG, 0, 1,
+   0},
+  {"CHARACTER_OCTET_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONG, 0, 1, 0},
+  {"NUMERIC_PRECISION", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONG, 0, 1, 0},
+  {"NUMERIC_SCALE", MY_INT64_NUM_DECIMAL_DIGITS , MYSQL_TYPE_LONG, 0, 1, 0},
   {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 1, 0},
   {"COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 1, "Collation"},
   {"COLUMN_TYPE", 65535, MYSQL_TYPE_STRING, 0, 0, "Type"},
@@ -4097,7 +4104,7 @@
 {
   {"COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Collation"},
   {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Charset"},
-  {"ID", 11, MYSQL_TYPE_LONG, 0, 0, "Id"},
+  {"ID", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 0, "Id"},
   {"IS_DEFAULT", 3, MYSQL_TYPE_STRING, 0, 0, "Default"},
   {"IS_COMPILED", 3, MYSQL_TYPE_STRING, 0, 0, "Compiled"},
   {"SORTLEN", 3 ,MYSQL_TYPE_LONG, 0, 0, "Sortlen"},
@@ -4150,7 +4157,7 @@
   {"SEQ_IN_INDEX", 2, MYSQL_TYPE_LONG, 0, 0, "Seq_in_index"},
   {"COLUMN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Column_name"},
   {"COLLATION", 1, MYSQL_TYPE_STRING, 0, 1, "Collation"},
-  {"CARDINALITY", 21, MYSQL_TYPE_LONG, 0, 1, "Cardinality"},
+  {"CARDINALITY", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, 1, "Cardinality"},
   {"SUB_PART", 3, MYSQL_TYPE_LONG, 0, 1, "Sub_part"},
   {"PACKED", 10, MYSQL_TYPE_STRING, 0, 1, "Packed"},
   {"NULLABLE", 3, MYSQL_TYPE_STRING, 0, 0, "Null"},

--- 1.333/sql/sql_table.cc	2007-02-21 14:05:03 +03:00
+++ 1.334/sql/sql_table.cc	2007-03-09 08:05:05 +03:00
@@ -4146,7 +4146,8 @@
 
   field_list.push_back(item = new Item_empty_string("Table", NAME_LEN*2));
   item->maybe_null= 1;
-  field_list.push_back(item=new Item_int("Checksum",(longlong) 1,21));
+  field_list.push_back(item= new Item_int("Checksum", (longlong) 1,
+                                          MY_INT64_NUM_DECIMAL_DIGITS));
   item->maybe_null= 1;
   if (protocol->send_fields(&field_list,
                             Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))

--- 1.153/sql/item_subselect.cc	2007-03-02 00:06:34 +03:00
+++ 1.154/sql/item_subselect.cc	2007-03-09 08:05:05 +03:00
@@ -1037,7 +1037,8 @@
       Item *having= item, *orig_item= item;
       select_lex->item_list.empty();
       select_lex->item_list.push_back(new Item_int("Not_used",
-                                                   (longlong) 1, 21));
+                                                   (longlong) 1,
+                                                   MY_INT64_NUM_DECIMAL_DIGITS));
       select_lex->ref_pointer_array[0]= select_lex->item_list.head();
        
       item= func->create(expr, item);

--- 1.308/sql/ha_innodb.cc	2007-02-22 17:59:55 +03:00
+++ 1.309/sql/ha_innodb.cc	2007-03-09 08:05:05 +03:00
@@ -6391,16 +6391,16 @@
 #ifdef UNIV_DEBUG
   field_list.push_back(new Item_empty_string("Mutex", FN_REFLEN));
   field_list.push_back(new Item_empty_string("Module", FN_REFLEN));
-  field_list.push_back(new Item_uint("Count", 21));
-  field_list.push_back(new Item_uint("Spin_waits", 21));
-  field_list.push_back(new Item_uint("Spin_rounds", 21));
-  field_list.push_back(new Item_uint("OS_waits", 21));
-  field_list.push_back(new Item_uint("OS_yields", 21));
-  field_list.push_back(new Item_uint("OS_waits_time", 21));
+  field_list.push_back(new Item_uint("Count", MY_INT64_NUM_DECIMAL_DIGITS));
+  field_list.push_back(new Item_uint("Spin_waits", MY_INT64_NUM_DECIMAL_DIGITS));
+  field_list.push_back(new Item_uint("Spin_rounds", MY_INT64_NUM_DECIMAL_DIGITS));
+  field_list.push_back(new Item_uint("OS_waits", MY_INT64_NUM_DECIMAL_DIGITS));
+  field_list.push_back(new Item_uint("OS_yields", MY_INT64_NUM_DECIMAL_DIGITS));
+  field_list.push_back(new Item_uint("OS_waits_time", MY_INT64_NUM_DECIMAL_DIGITS));
 #else /* UNIV_DEBUG */
   field_list.push_back(new Item_empty_string("File", FN_REFLEN));
-  field_list.push_back(new Item_uint("Line", 21));
-  field_list.push_back(new Item_uint("OS_waits", 21));
+  field_list.push_back(new Item_uint("Line", MY_INT64_NUM_DECIMAL_DIGITS));
+  field_list.push_back(new Item_uint("OS_waits", MY_INT64_NUM_DECIMAL_DIGITS));
 #endif /* UNIV_DEBUG */
 
   if (protocol->send_fields(&field_list,

--- 1.136/include/my_global.h	2007-02-22 17:59:54 +03:00
+++ 1.137/include/my_global.h	2007-03-09 08:05:04 +03:00
@@ -1357,4 +1357,13 @@
 #define NO_EMBEDDED_ACCESS_CHECKS
 #endif
 
+
+/* Length of decimal number represented by INT32. */
+
+#define MY_INT32_NUM_DECIMAL_DIGITS 11
+
+/* Length of decimal number represented by INT64. */
+
+#define MY_INT64_NUM_DECIMAL_DIGITS 21
+
 #endif /* my_global_h */
Thread
bk commit into 5.0 tree (anozdrin:1.2446)Alexander Nozdrin9 Mar