List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:February 2 2011 10:26am
Subject:bzr commit into mysql-next-mr-bugfixing branch (tor.didriksen:3265)
View as plain text  
#At file:///export/home/didrik/repo/next-mr-opt-backporting-wl4800-xx/ based on revid:guilhem.bichot@stripped

 3265 Tor Didriksen	2011-02-02
      Turn add_utf8_table into a member function rather than macro

    modified:
      sql/opt_trace.cc
      sql/opt_trace.h
=== modified file 'sql/opt_trace.cc'
--- a/sql/opt_trace.cc	2011-01-21 15:11:00 +0000
+++ b/sql/opt_trace.cc	2011-02-02 10:25:57 +0000
@@ -210,6 +210,14 @@ void Opt_trace_struct::do_destruct(void)
 }
 
 
+Opt_trace_struct& Opt_trace_struct::do_add_utf8_table(TABLE *tab)
+{
+  DBUG_ASSERT(started);
+  return
+    do_add("database", tab->s->db.str, tab->s->db.length, true).
+    do_add("table", tab->alias, strlen(tab->alias), true);
+}
+
 Opt_trace_struct& Opt_trace_struct::do_add(const char *key, const char *val,
                                            const size_t val_length,
                                            bool escape)

=== modified file 'sql/opt_trace.h'
--- a/sql/opt_trace.h	2011-01-17 20:41:34 +0000
+++ b/sql/opt_trace.h	2011-02-02 10:25:57 +0000
@@ -18,13 +18,15 @@
 
 #include "my_config.h"  // OPTIMIZER_TRACE
 #include "sql_array.h"  // Dynamic_array
-class THD;
-class st_select_lex;
 #include "my_base.h"    // ha_rows
 #include "sql_string.h" // String
 #include "sql_list.h"   // because sql_cmd.h needs it
 #include "sql_cmd.h"    // for enum_sql_command
 
+class THD;
+class st_select_lex;
+struct TABLE;
+
 /**
    @file
    API for the Optimizer trace (WL#5257)
@@ -995,6 +997,13 @@ public:
       return *this;
     return do_add_null(key);
   }
+  Opt_trace_struct& add_utf8_table(TABLE *tab)
+  {
+    if (likely(!started))
+      return *this;
+    return do_add_utf8_table(tab);
+  }
+
   /**
     The exception to RAII: this function is an explicit way to end a
     structure before it goes out of scope. Don't use it unless RAII mandates
@@ -1011,6 +1020,9 @@ private:
                     Opt_trace_context::feature_value feature);
   /** Really does destruction */
   void do_destruct(void);
+
+  Opt_trace_struct& do_add_utf8_table(TABLE *tab);
+
   /**
      Really adds to the object. @sa add().
      @param  escape  do JSON-compliant escaping of 'value'.
@@ -1431,20 +1443,13 @@ public:
    @param from           description of the before-transformation state
    @param to             description of the after-transformation state
 */
-#define OPT_TRACE_TRANSFORM(trace,object_level0,object_level1,select_number,from,to) \
+#define OPT_TRACE_TRANSFORM(trace,object_level0,object_level1,          \
+                            select_number,from,to)                      \
   Opt_trace_object object_level0(trace);                                \
   Opt_trace_object object_level1(trace, "transformation");              \
   opt_trace_add_select_number(&object_level1, select_number);           \
   object_level1.add_alnum("from", from).add_alnum("to", to);
 
-/**
-   Helper to put the database/table name in the trace
-   @param  t  TABLE* pointer
-*/
-#define add_utf8_table(t)                                               \
-  add_utf8("database", (t)->s->db.str, (t)->s->db.length).              \
-  add_utf8("table", (t)->alias)
-
 #if !defined(DBUG_OFF) && !defined(OPTIMIZER_TRACE)
 
 /*


Attachment: [text/bzr-bundle] bzr/tor.didriksen@oracle.com-20110202102557-q9dgdbbz9emen6gp.bundle
Thread
bzr commit into mysql-next-mr-bugfixing branch (tor.didriksen:3265) Tor Didriksen2 Feb