12#include "../../DataBinder/SqlValueStorage.hpp"
13#include "SqlOdbcPrelude.hpp"
14#include "SqlServerTime2.hpp"
22namespace Lightweight::Driver::Odbc::detail
26template <
typename Ours,
typename Odbc>
27inline constexpr bool SameStorageLayout =
sizeof(Ours) ==
sizeof(Odbc) &&
alignof(Ours) ==
alignof(Odbc)
28 && std::is_standard_layout_v<Ours> && std::is_trivially_copyable_v<Ours>;
30static_assert(SameStorageLayout<SqlDateStorage, SQL_DATE_STRUCT>);
31static_assert(SameStorageLayout<SqlTimestampStorage, SQL_TIMESTAMP_STRUCT>);
32static_assert(SameStorageLayout<SqlTime2Storage, SQL_SS_TIME2_STRUCT>);
33static_assert(SameStorageLayout<SqlNumericStorage, SQL_NUMERIC_STRUCT>);
34static_assert(
sizeof(SqlTime2Storage) == 12);
36static_assert(offsetof(SqlDateStorage, year) == offsetof(SQL_DATE_STRUCT, year));
37static_assert(offsetof(SqlDateStorage, month) == offsetof(SQL_DATE_STRUCT, month));
38static_assert(offsetof(SqlDateStorage, day) == offsetof(SQL_DATE_STRUCT, day));
39static_assert(offsetof(SqlTimestampStorage, year) == offsetof(SQL_TIMESTAMP_STRUCT, year));
40static_assert(offsetof(SqlTimestampStorage, month) == offsetof(SQL_TIMESTAMP_STRUCT, month));
41static_assert(offsetof(SqlTimestampStorage, day) == offsetof(SQL_TIMESTAMP_STRUCT, day));
42static_assert(offsetof(SqlTimestampStorage, hour) == offsetof(SQL_TIMESTAMP_STRUCT, hour));
43static_assert(offsetof(SqlTimestampStorage, minute) == offsetof(SQL_TIMESTAMP_STRUCT, minute));
44static_assert(offsetof(SqlTimestampStorage, second) == offsetof(SQL_TIMESTAMP_STRUCT, second));
45static_assert(offsetof(SqlTimestampStorage, fraction) == offsetof(SQL_TIMESTAMP_STRUCT, fraction));
49static_assert(offsetof(SqlTime2Storage, fraction) == offsetof(
SQL_SS_TIME2_STRUCT, fraction));
50static_assert(offsetof(SqlNumericStorage, precision) == offsetof(SQL_NUMERIC_STRUCT, precision));
51static_assert(offsetof(SqlNumericStorage, scale) == offsetof(SQL_NUMERIC_STRUCT, scale));
52static_assert(offsetof(SqlNumericStorage, sign) == offsetof(SQL_NUMERIC_STRUCT, sign));
53static_assert(offsetof(SqlNumericStorage, val) == offsetof(SQL_NUMERIC_STRUCT, val));
The SQL Server ODBC extension's buffer for a TIME(7) value (SQL_SS_TIME2 in msodbcsql....