1 | #include "duckdb/common/operator/convert_to_string.hpp" |
---|---|
2 | #include "duckdb/common/operator/string_cast.hpp" |
3 | #include "duckdb/common/types/vector.hpp" |
4 | |
5 | namespace duckdb { |
6 | |
7 | template <class T> |
8 | string StandardStringCast(T input) { |
9 | Vector v(LogicalType::VARCHAR); |
10 | return StringCast::Operation(input, v).GetString(); |
11 | } |
12 | |
13 | template <> |
14 | string ConvertToString::Operation(bool input) { |
15 | return StandardStringCast(input); |
16 | } |
17 | template <> |
18 | string ConvertToString::Operation(int8_t input) { |
19 | return StandardStringCast(input); |
20 | } |
21 | template <> |
22 | string ConvertToString::Operation(int16_t input) { |
23 | return StandardStringCast(input); |
24 | } |
25 | template <> |
26 | string ConvertToString::Operation(int32_t input) { |
27 | return StandardStringCast(input); |
28 | } |
29 | template <> |
30 | string ConvertToString::Operation(int64_t input) { |
31 | return StandardStringCast(input); |
32 | } |
33 | template <> |
34 | string ConvertToString::Operation(uint8_t input) { |
35 | return StandardStringCast(input); |
36 | } |
37 | template <> |
38 | string ConvertToString::Operation(uint16_t input) { |
39 | return StandardStringCast(input); |
40 | } |
41 | template <> |
42 | string ConvertToString::Operation(uint32_t input) { |
43 | return StandardStringCast(input); |
44 | } |
45 | template <> |
46 | string ConvertToString::Operation(uint64_t input) { |
47 | return StandardStringCast(input); |
48 | } |
49 | template <> |
50 | string ConvertToString::Operation(hugeint_t input) { |
51 | return StandardStringCast(input); |
52 | } |
53 | template <> |
54 | string ConvertToString::Operation(float input) { |
55 | return StandardStringCast(input); |
56 | } |
57 | template <> |
58 | string ConvertToString::Operation(double input) { |
59 | return StandardStringCast(input); |
60 | } |
61 | template <> |
62 | string ConvertToString::Operation(interval_t input) { |
63 | return StandardStringCast(input); |
64 | } |
65 | template <> |
66 | string ConvertToString::Operation(date_t input) { |
67 | return StandardStringCast(input); |
68 | } |
69 | template <> |
70 | string ConvertToString::Operation(dtime_t input) { |
71 | return StandardStringCast(input); |
72 | } |
73 | template <> |
74 | string ConvertToString::Operation(timestamp_t input) { |
75 | return StandardStringCast(input); |
76 | } |
77 | template <> |
78 | string ConvertToString::Operation(string_t input) { |
79 | return input.GetString(); |
80 | } |
81 | |
82 | } // namespace duckdb |
83 |