Skip to content

Commit 00a6fee

Browse files
Ksenia-Cfdr400
authored andcommitted
fix clickhouse: fix floating point escaping
Pull Request resolved: <#922> commit_hash:7adaae15d6e516f3231549ab220f0e5afcf31dfa
1 parent eef916e commit 00a6fee

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

clickhouse/include/userver/storages/clickhouse/io/floating_point_types.hpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
/// @file userver/storages/clickhouse/io/floating_point_types.hpp
44
/// @brief @copybrief storages::clickhouse::io::FloatingWithPrecision
55

6+
#if FMT_VERSION >= 110000
7+
#include <fmt/base.h> // Y_IGNORE
8+
#endif
69
#include <fmt/format.h>
710

811
USERVER_NAMESPACE_BEGIN
@@ -53,12 +56,29 @@ class FloatingWithPrecision {
5356
private:
5457
FloatingPointT value_;
5558

59+
#if FMT_VERSION >= 110100
60+
constexpr static fmt::format_specs spec_ = []() {
61+
fmt::format_specs spec;
62+
spec.precision = Precision;
63+
spec.set_type(fmt::presentation_type::fixed);
64+
return spec;
65+
}();
66+
#elif FMT_VERSION >= 110000
67+
constexpr static fmt::format_specs spec_ = []() {
68+
fmt::format_specs spec;
69+
spec.precision = Precision;
70+
spec.type = fmt::presentation_type::fixed;
71+
return spec;
72+
}();
73+
#else
5674
constexpr static fmt::basic_format_specs<char> spec_ = []() {
5775
fmt::basic_format_specs<char> spec;
5876
spec.precision = Precision;
5977
spec.type = fmt::presentation_type::fixed_lower;
6078
return spec;
6179
}();
80+
#endif
81+
6282
template <typename U, std::uint32_t AnotherPrecision, typename>
6383
friend class FloatingWithPrecision;
6484
};

0 commit comments

Comments
 (0)