summaryrefslogtreecommitdiff
path: root/sql/my_json_writer.cc
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2019-02-18 17:11:20 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2019-02-18 17:11:20 +0530
commit9cb55143ac78c8c0dc4781883bd24ee9284dbbce (patch)
treeaf18e55a055186fd988f536cf349484a6c3a2e26 /sql/my_json_writer.cc
parent7d2138d4a4788b8979c13e995d357097b0372ae2 (diff)
downloadmariadb-git-9cb55143ac78c8c0dc4781883bd24ee9284dbbce.tar.gz
Minor cleanup in the optimizer trace code.
More test coverage added for the optimizer trace.
Diffstat (limited to 'sql/my_json_writer.cc')
-rw-r--r--sql/my_json_writer.cc20
1 files changed, 15 insertions, 5 deletions
diff --git a/sql/my_json_writer.cc b/sql/my_json_writer.cc
index 7ae0c58bd7d..3755f8d4bcb 100644
--- a/sql/my_json_writer.cc
+++ b/sql/my_json_writer.cc
@@ -219,15 +219,15 @@ void Json_writer::add_str(const String &str)
add_str(str.ptr(), str.length());
}
-Json_writer_object::Json_writer_object(THD *thd) :
+Json_writer_object::Json_writer_object(THD *thd) :
Json_writer_struct(thd)
{
if (my_writer)
my_writer->start_object();
}
-Json_writer_object::Json_writer_object(THD* thd, const char *str)
- : Json_writer_struct(thd)
+Json_writer_object::Json_writer_object(THD* thd, const char *str) :
+ Json_writer_struct(thd)
{
if (my_writer)
my_writer->add_member(str).start_object();
@@ -247,8 +247,8 @@ Json_writer_array::Json_writer_array(THD *thd) :
my_writer->start_array();
}
-Json_writer_array::Json_writer_array(THD *thd, const char *str)
- :Json_writer_struct(thd)
+Json_writer_array::Json_writer_array(THD *thd, const char *str) :
+ Json_writer_struct(thd)
{
if (my_writer)
my_writer->add_member(str).start_array();
@@ -263,6 +263,16 @@ Json_writer_array::~Json_writer_array()
}
}
+Json_writer_temp_disable::Json_writer_temp_disable(THD *thd_arg)
+{
+ thd= thd_arg;
+ thd->opt_trace.disable_tracing_if_required();
+}
+Json_writer_temp_disable::~Json_writer_temp_disable()
+{
+ thd->opt_trace.enable_tracing_if_required();
+}
+
bool Single_line_formatting_helper::on_add_member(const char *name)
{
DBUG_ASSERT(state== INACTIVE || state == DISABLED);