[Commits] Rev 3454: TODO-220 after-review fixes. in http://bazaar.launchpad.net/~maria-captains/maria/5.5

knielsen at knielsen-hq.org knielsen at knielsen-hq.org
Wed Aug 22 15:47:28 EEST 2012


At http://bazaar.launchpad.net/~maria-captains/maria/5.5

------------------------------------------------------------
revno: 3454
revision-id: knielsen at knielsen-hq.org-20120822124728-7m62lp72hoogayn8
parent: knielsen at knielsen-hq.org-20120810142232-xcxruc27mp6ctk1i
committer: knielsen at knielsen-hq.org
branch nick: work-5.5-todo220
timestamp: Wed 2012-08-22 14:47:28 +0200
message:
  TODO-220 after-review fixes.
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2012-07-06 09:19:16 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2012-08-22 12:47:28 +0000
@@ -1295,7 +1295,9 @@ int ndbcluster_log_schema_op(THD *thd, N
     DBUG_RETURN(0);
   }
 
-  String tmp_buf2;
+  char tmp_buf2_mem[FN_REFLEN];
+  String tmp_buf2(tmp_buf2_mem, sizeof(tmp_buf2_mem), system_charset_info);
+  tmp_buf2.length(0);
   const char *type_str;
   switch (type)
   {

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2012-08-10 14:22:32 +0000
+++ b/sql/log_event.cc	2012-08-22 12:47:28 +0000
@@ -2452,7 +2452,9 @@ Log_event::continue_group(Relay_log_info
 void Query_log_event::pack_info(THD *thd, Protocol *protocol)
 {
   // TODO: show the catalog ??
-  String buf(9 + db_len + q_len);
+  char buf_mem[1024];
+  String buf(buf_mem, sizeof(buf_mem), system_charset_info);
+  buf.real_alloc(9 + db_len + q_len);
   if (!(flags & LOG_EVENT_SUPPRESS_USE_F)
       && db && db_len)
   {
@@ -4851,6 +4853,7 @@ void Load_log_event::pack_info(THD *thd,
   char query_buffer[1024];
   String query_str(query_buffer, sizeof(query_buffer), system_charset_info);
 
+  query_str.length(0);
   print_query(thd, TRUE, NULL, &query_str, 0, 0, NULL);
   protocol->store(query_str.ptr(), query_str.length(), &my_charset_bin);
 }
@@ -5314,6 +5317,7 @@ int Load_log_event::do_apply_event(NET*
       String query_str(query_buffer, sizeof(query_buffer), system_charset_info);
       char *load_data_query;
 
+      query_str.length(0);
       /*
         Forge LOAD DATA INFILE query which will be used in SHOW PROCESS LIST
         and written to slave's binlog if binlogging is on.
@@ -6112,11 +6116,11 @@ user_var_append_name_part(THD *thd, Stri
 
 void User_var_log_event::pack_info(THD *thd, Protocol* protocol)
 {
-  uint val_offset= 4 + name_len;
-
   if (is_null)
   {
-    String buf(val_offset + 5);
+    char buf_mem[FN_REFLEN+7];
+    String buf(buf_mem, sizeof(buf_mem), system_charset_info);
+    buf.length(0);
     if (user_var_append_name_part(thd, &buf, name, name_len) ||
         buf.append("NULL"))
       return;
@@ -6129,8 +6133,10 @@ void User_var_log_event::pack_info(THD *
     {
       double real_val;
       char buf2[MY_GCVT_MAX_FIELD_WIDTH+1];
-      String buf(val_offset + MY_GCVT_MAX_FIELD_WIDTH + 1);
+      char buf_mem[FN_REFLEN + MY_GCVT_MAX_FIELD_WIDTH + 1];
+      String buf(buf_mem, sizeof(buf_mem), system_charset_info);
       float8get(real_val, val);
+      buf.length(0);
       if (user_var_append_name_part(thd, &buf, name, name_len) ||
           buf.append(buf2, my_gcvt(real_val, MY_GCVT_ARG_DOUBLE,
                                    MY_GCVT_MAX_FIELD_WIDTH, buf2, NULL)))
@@ -6141,7 +6147,9 @@ void User_var_log_event::pack_info(THD *
     case INT_RESULT:
     {
       char buf2[22];
-      String buf(val_offset + 22);
+      char buf_mem[FN_REFLEN + 22];
+      String buf(buf_mem, sizeof(buf_mem), system_charset_info);
+      buf.length(0);
       if (user_var_append_name_part(thd, &buf, name, name_len) ||
           buf.append(buf2,
                  longlong10_to_str(uint8korr(val), buf2,
@@ -6152,10 +6160,12 @@ void User_var_log_event::pack_info(THD *
     }
     case DECIMAL_RESULT:
     {
-      String buf(val_offset + DECIMAL_MAX_STR_LENGTH);
+      char buf_mem[FN_REFLEN + DECIMAL_MAX_STR_LENGTH];
+      String buf(buf_mem, sizeof(buf_mem), system_charset_info);
       char buf2[DECIMAL_MAX_STR_LENGTH+1];
       String str(buf2, sizeof(buf2), &my_charset_bin);
       my_decimal dec;
+      buf.length(0);
       binary2my_decimal(E_DEC_FATAL_ERROR, (uchar*) (val+2), &dec, val[0],
                         val[1]);
       my_decimal2string(E_DEC_FATAL_ERROR, &dec, 0, 0, 0, &str);
@@ -6168,8 +6178,10 @@ void User_var_log_event::pack_info(THD *
     case STRING_RESULT:
     {
       /* 15 is for 'COLLATE' and other chars */
-      String buf(val_offset+val_len*2+1+2*MY_CS_NAME_SIZE+15);
+      char buf_mem[FN_REFLEN + 512 + 1 + 2*MY_CS_NAME_SIZE+15];
+      String buf(buf_mem, sizeof(buf_mem), system_charset_info);
       CHARSET_INFO *cs;
+      buf.length(0);
       if (!(cs= get_charset(charset_number, MYF(0))))
       {
         if (buf.append("???"))
@@ -7650,7 +7662,9 @@ void Execute_load_query_log_event::print
 #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
 void Execute_load_query_log_event::pack_info(THD *thd, Protocol *protocol)
 {
-  String buf(9 + db_len + q_len + 10 + 21);
+  char buf_mem[1024];
+  String buf(buf_mem, sizeof(buf_mem), system_charset_info);
+  buf.real_alloc(9 + db_len + q_len + 10 + 21);
   if (db && db_len)
   {
     if (buf.append("use ") ||

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2012-07-06 09:19:16 +0000
+++ b/sql/sql_base.cc	2012-08-22 12:47:28 +0000
@@ -3887,7 +3887,9 @@ static bool open_table_entry_fini(THD *t
     entry->file->implicit_emptied= 0;
     if (mysql_bin_log.is_open())
     {
-      String query(20 + share->db.length + share->table_name.length +1);
+      char query_buf[2*FN_REFLEN + 21];
+      String query(query_buf, sizeof(query_buf), system_charset_info);
+      query.length(0);
       if (query.ptr())
       {
         /* this DELETE FROM is needed even with row-based binlogging */



More information about the commits mailing list