summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Krivonos <sergei.krivonos@mariadb.com>2021-11-15 00:42:26 +0200
committerSergei Krivonos <sergeikrivonos@gmail.com>2021-11-19 01:55:23 +0200
commitd4d71153dbeb896589d1d56c9746b4e0b54f110e (patch)
tree862ea354f53a2fb5768bca4a675b81188226afc0 /sql
parent8101af68fac5121cc2c44583c77c12f4f7318599 (diff)
downloadmariadb-git-d4d71153dbeb896589d1d56c9746b4e0b54f110e.tar.gz
Json_writer_object add integersbb-10.4-MDEV-27036
Diffstat (limited to 'sql')
-rw-r--r--sql/my_json_writer.h28
-rw-r--r--sql/opt_range.cc2
-rw-r--r--sql/sql_select.cc2
3 files changed, 16 insertions, 16 deletions
diff --git a/sql/my_json_writer.h b/sql/my_json_writer.h
index 0bd1e550439..4b69ba70675 100644
--- a/sql/my_json_writer.h
+++ b/sql/my_json_writer.h
@@ -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 @@ public:
}
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 @@ public:
}
return *this;
}
+
Json_writer_object& add(const char *name, double value)
{
DBUG_ASSERT(!closed);
@@ -470,18 +481,7 @@ public:
}
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);
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 47bf8f1682f..5f13c9b3441 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -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,
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index e12eeb6c815..3272f8b7f65 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -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;
}
}