Commit cba065f4 authored by Sergei Krivonos's avatar Sergei Krivonos Committed by Sergei Krivonos

Json_writer_object add integers

parent 691f7e16
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
#include "my_base.h" #include "my_base.h"
#if !defined(NDEBUG) || defined(JSON_WRITER_UNIT_TEST) || defined ENABLED_JSON_WRITER_CONSISTENCY_CHECKS #if !defined(NDEBUG) || defined(JSON_WRITER_UNIT_TEST) || defined ENABLED_JSON_WRITER_CONSISTENCY_CHECKS
#include <set>
#include <stack>
#include <string>
#include <vector> #include <vector>
#endif #endif
...@@ -31,6 +34,8 @@ ...@@ -31,6 +34,8 @@
#define VALIDITY_ASSERT(x) DBUG_ASSERT(x) #define VALIDITY_ASSERT(x) DBUG_ASSERT(x)
#endif #endif
#include <type_traits>
class Opt_trace_stmt; class Opt_trace_stmt;
class Opt_trace_context; class Opt_trace_context;
class Json_writer; class Json_writer;
...@@ -462,17 +467,22 @@ class Json_writer_object : public Json_writer_struct ...@@ -462,17 +467,22 @@ class Json_writer_object : public Json_writer_struct
} }
return *this; return *this;
} }
Json_writer_object& add(const char *name, ulonglong value) Json_writer_object& add(const char *name, ulonglong value)
{ {
DBUG_ASSERT(!closed); DBUG_ASSERT(!closed);
if (my_writer) if (my_writer)
{ {
add_member(name); add_member(name);
context.add_ll(static_cast<longlong>(value)); my_writer->add_ull(value);
} }
return *this; return *this;
} }
Json_writer_object& add(const char *name, longlong value)
template<class IntT,
typename= typename ::std::enable_if<std::is_integral<IntT>::value>::type
>
Json_writer_object& add(const char *name, IntT value)
{ {
DBUG_ASSERT(!closed); DBUG_ASSERT(!closed);
if (my_writer) if (my_writer)
...@@ -482,6 +492,7 @@ class Json_writer_object : public Json_writer_struct ...@@ -482,6 +492,7 @@ class Json_writer_object : public Json_writer_struct
} }
return *this; return *this;
} }
Json_writer_object& add(const char *name, double value) Json_writer_object& add(const char *name, double value)
{ {
DBUG_ASSERT(!closed); DBUG_ASSERT(!closed);
...@@ -492,18 +503,7 @@ class Json_writer_object : public Json_writer_struct ...@@ -492,18 +503,7 @@ class Json_writer_object : public Json_writer_struct
} }
return *this; return *this;
} }
#ifndef _WIN64
Json_writer_object& add(const char *name, size_t value)
{
DBUG_ASSERT(!closed);
if (my_writer)
{
add_member(name);
context.add_ll(static_cast<longlong>(value));
}
return *this;
}
#endif
Json_writer_object& add(const char *name, const char *value) Json_writer_object& add(const char *name, const char *value)
{ {
DBUG_ASSERT(!closed); DBUG_ASSERT(!closed);
......
...@@ -6939,7 +6939,7 @@ static bool ror_intersect_add(ROR_INTERSECT_INFO *info, ...@@ -6939,7 +6939,7 @@ static bool ror_intersect_add(ROR_INTERSECT_INFO *info,
DBUG_PRINT("info", ("info->total_cost= %g", info->total_cost)); DBUG_PRINT("info", ("info->total_cost= %g", info->total_cost));
} }
else else
trace_costs->add("disk_sweep_cost", static_cast<longlong>(0)); trace_costs->add("disk_sweep_cost", 0);
DBUG_PRINT("info", ("New out_rows: %g", info->out_rows)); DBUG_PRINT("info", ("New out_rows: %g", info->out_rows));
DBUG_PRINT("info", ("New cost: %g, %scovering", info->total_cost, DBUG_PRINT("info", ("New cost: %g, %scovering", info->total_cost,
......
...@@ -404,7 +404,7 @@ static void trace_table_dependencies(THD *thd, ...@@ -404,7 +404,7 @@ static void trace_table_dependencies(THD *thd,
{ {
if (map & (1ULL << j)) if (map & (1ULL << j))
{ {
trace_one_table.add("map_bit", static_cast<longlong>(j)); trace_one_table.add("map_bit", j);
break; break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment