|
30 | 30 |
|
31 | 31 | #include <arrow-adbc/adbc.h> |
32 | 32 |
|
| 33 | +#include "fmt/core.h" |
| 34 | + |
33 | 35 | #include "driver/framework/status.h" |
34 | 36 |
|
35 | 37 | /// \file base.h ADBC Driver Framework |
@@ -170,19 +172,16 @@ class Option { |
170 | 172 | using T = std::decay_t<decltype(value)>; |
171 | 173 | if constexpr (std::is_same_v<T, std::string> || std::is_same_v<T, int64_t> || |
172 | 174 | std::is_same_v<T, double>) { |
173 | | - char formatted[24]; // Enough room for double/int64_t |
174 | 175 | std::string_view string_value; |
175 | | - if constexpr (std::is_same_v<T, std::string>) { |
176 | | - string_value = value; |
| 176 | + std::string allocated_value; |
| 177 | + if constexpr (std::is_same_v<T, int64_t>) { |
| 178 | + allocated_value = fmt::format("{}", value); |
| 179 | + string_value = allocated_value; |
| 180 | + } else if constexpr (std::is_same_v<T, double>) { |
| 181 | + allocated_value = fmt::format("{}", value); |
| 182 | + string_value = allocated_value; |
177 | 183 | } else { |
178 | | - auto result = |
179 | | - std::to_chars(formatted, formatted + sizeof(formatted), value); |
180 | | - if (result.ec != std::errc()) { |
181 | | - return status::Internal("Could not format numeric option value") |
182 | | - .ToAdbc(error); |
183 | | - } |
184 | | - string_value = std::string_view( |
185 | | - formatted, static_cast<size_t>(result.ptr - formatted)); |
| 184 | + string_value = value; |
186 | 185 | } |
187 | 186 | size_t value_size_with_terminator = string_value.size() + 1; |
188 | 187 | if (*length >= value_size_with_terminator) { |
|
0 commit comments