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

Json_writer_object add integers

parent 8101af68
......@@ -18,6 +18,9 @@
#include "my_base.h"
#if !defined(NDEBUG) || defined(JSON_WRITER_UNIT_TEST)
#include <set>
#include <stack>
#include <string>
#include <vector>
#endif
......@@ -30,6 +33,8 @@
#define VALIDITY_ASSERT(x) DBUG_ASSERT(x)
#endif
#include <type_traits>
class Opt_trace_stmt;
class Opt_trace_context;
class Json_writer;
......@@ -440,17 +445,22 @@ class Json_writer_object : public Json_writer_struct
}
return *this;
}
Json_writer_object& add(const char *name, ulonglong value)
{
DBUG_ASSERT(!closed);
if (my_writer)
{
add_member(name);
context.add_ll(static_cast<longlong>(value));
my_writer->add_ull(value);
}
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);
if (my_writer)
......@@ -460,6 +470,7 @@ class Json_writer_object : public Json_writer_struct
}
return *this;
}
Json_writer_object& add(const char *name, double value)
{
DBUG_ASSERT(!closed);
......@@ -470,18 +481,7 @@ class Json_writer_object : public Json_writer_struct
}
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)
{
DBUG_ASSERT(!closed);
......
......@@ -6908,7 +6908,7 @@ static bool ror_intersect_add(ROR_INTERSECT_INFO *info,
DBUG_PRINT("info", ("info->total_cost= %g", info->total_cost));
}
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 cost: %g, %scovering", info->total_cost,
......
......@@ -396,7 +396,7 @@ static void trace_table_dependencies(THD *thd,
{
if (map & (1ULL << j))
{
trace_one_table.add("map_bit", static_cast<longlong>(j));
trace_one_table.add("map_bit", j);
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