5#if defined(_WIN32) || defined(_WIN64)
10#include "../SqlServerType.hpp"
39 virtual void PlanPostExecuteCallback(std::function<
void()>&&) = 0;
40 virtual void PlanPostProcessOutputColumn(std::function<
void()>&&) = 0;
41 [[nodiscard]]
virtual SqlServerType ServerType()
const noexcept = 0;
52struct SqlBasicStringOperations;
61concept HasGetStringAndGetLength =
requires(T
const& t) {
62 { t.GetLength() } -> std::same_as<int>;
63 { t.GetString() } -> std::same_as<char const*>;
67concept HasGetStringAndLength =
requires(T
const& t)
69 { t.Length() } -> std::same_as<int>;
70 { t.GetString() } -> std::same_as<char const*>;
78concept HasSqlViewHelper =
requires(T
const& t) {
79 { SqlViewHelper<T>::View(t) } -> std::convertible_to<std::string_view>;
82template <
typename CharT>
83struct SqlViewHelper<std::basic_string<CharT>>
85 static LIGHTWEIGHT_FORCE_INLINE std::basic_string_view<CharT> View(std::basic_string<CharT>
const& str)
noexcept
87 return { str.data(), str.size() };
91template <detail::HasGetStringAndGetLength CStringLike>
92struct SqlViewHelper<CStringLike>
94 static LIGHTWEIGHT_FORCE_INLINE std::string_view View(CStringLike
const& str)
noexcept
96 return { str.GetString(),
static_cast<size_t>(str.GetLength()) };
100template <detail::HasGetStringAndLength StringLike>
101struct SqlViewHelper<StringLike>
103 static LIGHTWEIGHT_FORCE_INLINE std::string_view View(StringLike
const& str)
noexcept
105 return { str.GetString(),
static_cast<size_t>(str.Length()) };
114concept SqlInputParameterBinder =
116 { SqlDataBinder<T>::InputParameter(hStmt, column, value, cb) } -> std::same_as<SQLRETURN>;
120concept SqlOutputColumnBinder =
121 requires(SQLHSTMT hStmt, SQLUSMALLINT column, T* result, SQLLEN* indicator,
SqlDataBinderCallback& cb) {
122 { SqlDataBinder<T>::OutputColumn(hStmt, column, result, indicator, cb) } -> std::same_as<SQLRETURN>;
126concept SqlInputParameterBatchBinder =
127 requires(SQLHSTMT hStmt, SQLUSMALLINT column, std::ranges::range_value_t<T>* result,
SqlDataBinderCallback& cb) {
129 SqlDataBinder<std::ranges::range_value_t<T>>::InputParameter(
130 hStmt, column, std::declval<std::ranges::range_value_t<T>>(), cb)
131 } -> std::same_as<SQLRETURN>;
135concept SqlGetColumnNativeType =
136 requires(SQLHSTMT hStmt, SQLUSMALLINT column, T* result, SQLLEN* indicator,
SqlDataBinderCallback const& cb) {
137 { SqlDataBinder<T>::GetColumn(hStmt, column, result, indicator, cb) } -> std::same_as<SQLRETURN>;
141concept SqlDataBinderSupportsInspect =
requires(T
const& value) {
142 { SqlDataBinder<std::remove_cvref_t<T>>::Inspect(value) } -> std::convertible_to<std::string>;
146template <
typename StringType,
typename CharType>
147concept SqlBasicStringBinderConcept =
requires(StringType* str) {
148 { SqlBasicStringOperations<StringType>::Data(str) } -> std::same_as<CharType*>;
149 { SqlBasicStringOperations<StringType>::Size(str) } -> std::same_as<SQLULEN>;
150 { SqlBasicStringOperations<StringType>::Reserve(str,
size_t {}) } -> std::same_as<void>;
151 { SqlBasicStringOperations<StringType>::Resize(str, SQLLEN {}) } -> std::same_as<void>;
152 { SqlBasicStringOperations<StringType>::Clear(str) } -> std::same_as<void>;