3#include "../SqlColumnTypeDefinitions.hpp"
4#include "BasicStringBinder.hpp"
19 using std::vector<uint8_t>::vector;
21 constexpr auto operator<=>(
SqlBinary const&)
const noexcept =
default;
26 mutable SQLLEN _indicator = 0;
32 static constexpr auto ColumnType = SqlColumnTypeDefinitions::Binary { 255 };
34 static LIGHTWEIGHT_FORCE_INLINE SQLRETURN InputParameter(SQLHSTMT stmt,
39 value._indicator =
static_cast<SQLLEN
>(value.size());
40 return SQLBindParameter(stmt,
47 (SQLPOINTER) value.data(),
52 static LIGHTWEIGHT_FORCE_INLINE SQLRETURN OutputColumn(
58 cb.PlanPostProcessOutputColumn([stmt, column, result, indicator]() {
59 if (*indicator == SQL_NULL_DATA)
62 else if (*indicator == SQL_NO_TOTAL)
64 result->resize(result->size() - 1);
65 else if (*indicator <=
static_cast<SQLLEN
>(result->size()))
66 result->resize(*indicator);
72 auto const totalCharsRequired = *indicator;
73 result->resize(totalCharsRequired + 1);
74 auto const sqlResult = SQLGetData(
75 stmt, column, SQL_C_BINARY, (SQLPOINTER) result->data(), totalCharsRequired + 1, indicator);
77 assert(SQL_SUCCEEDED(sqlResult));
78 assert(*indicator == totalCharsRequired);
79 result->resize(totalCharsRequired);
83 return SQLBindCol(stmt, column, SQL_C_BINARY, (SQLPOINTER) result->data(), 255, indicator);
86 static LIGHTWEIGHT_FORCE_INLINE SQLRETURN GetColumn(SQLHSTMT stmt,
95 return detail::GetArrayData<SQL_C_BINARY>(stmt, column, result, indicator);
98 static LIGHTWEIGHT_FORCE_INLINE std::string Inspect(
SqlBinary const& value)
100 return std::format(
"SqlBinary(size={})", value.size());
Represents a binary data type.