MCPcopy Create free account
hub / github.com/apache/arrow / GetAttributeUTF8

Function GetAttributeUTF8

cpp/src/arrow/flight/sql/odbc/odbc_impl/attribute_utils.h:47–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45
46template <typename O>
47inline SQLRETURN GetAttributeUTF8(std::string_view attribute_value, SQLPOINTER output,
48 O output_size, O* output_len_ptr) {
49 if (output) {
50 size_t output_len_before_null =
51 std::min(static_cast<O>(attribute_value.size()), static_cast<O>(output_size - 1));
52 std::memcpy(output, attribute_value.data(), output_len_before_null);
53 reinterpret_cast<char*>(output)[output_len_before_null] = '\0';
54 }
55
56 if (output_len_ptr) {
57 *output_len_ptr = static_cast<O>(attribute_value.size());
58 }
59
60 if (output && output_size < static_cast<O>(attribute_value.size() + 1)) {
61 return SQL_SUCCESS_WITH_INFO;
62 }
63 return SQL_SUCCESS;
64}
65
66template <typename O>
67inline SQLRETURN GetAttributeUTF8(std::string_view attribute_value, SQLPOINTER output,

Callers 1

GetStringAttributeFunction · 0.85

Calls 3

AddTruncationWarningMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected