Skip to content

Commit

Permalink
removed std::wstring& vector_wstring_value(exchange_type e, void* dat…
Browse files Browse the repository at this point in the history
…a, std::size_t ind)
  • Loading branch information
bold84 committed Mar 31, 2024
1 parent 130603b commit 708613e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 32 deletions.
29 changes: 0 additions & 29 deletions include/private/soci-vector-helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,35 +162,6 @@ inline std::string& vector_string_value(exchange_type e, void *data, std::size_t
throw soci_error("Can't get the string value from the vector of values with non-supported type.");
}

inline std::wstring& vector_wstring_value(exchange_type e, void* data, std::size_t ind)
{
switch (e)
{
case x_stdwstring:
return exchange_vector_type_cast<x_stdwstring>(data).at(ind);
case x_stdstring:
case x_xmltype:
case x_longstring:
case x_char:
case x_wchar:
case x_int8:
case x_uint8:
case x_int16:
case x_uint16:
case x_int32:
case x_uint32:
case x_int64:
case x_uint64:
case x_double:
case x_stdtm:
case x_statement:
case x_rowid:
case x_blob:
break;
}
throw soci_error("Can't get the string value from the vector of values with non-supported type.");
}

} // namespace details

} // namespace soci
Expand Down
2 changes: 1 addition & 1 deletion src/backends/odbc/vector-into-type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ void odbc_vector_into_type_backend::do_post_fetch_rows(
{
SQLLEN len = get_sqllen_from_vector_at(i);

std::wstring& value = vector_wstring_value(type_, data_, i);
std::wstring& value = exchange_vector_type_cast<x_stdwstring>(data_).at(i);
if (len == -1)
{
// Value is null.
Expand Down
4 changes: 2 additions & 2 deletions src/backends/odbc/vector-use-type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void* odbc_vector_use_type_backend::prepare_for_bind(SQLUINTEGER &size,
prepare_indicators(vecSize);
for (std::size_t i = 0; i != vecSize; ++i)
{
std::size_t sz = vector_wstring_value(type_, data_, i).length();
std::size_t sz = exchange_vector_type_cast<x_stdwstring>(data_).at(i).length();
set_sqllen_from_vector_at(i, static_cast<long>(sz) * sizeof(wchar_t));
maxSize = sz > maxSize ? sz : maxSize;
}
Expand All @@ -275,7 +275,7 @@ void* odbc_vector_use_type_backend::prepare_for_bind(SQLUINTEGER &size,
char *pos = buf_;
for (std::size_t i = 0; i != vecSize; ++i)
{
std::wstring& value = vector_wstring_value(type_, data_, i);
std::wstring& value = exchange_vector_type_cast<x_stdwstring>(data_).at(i);
std::memcpy(pos, value.c_str(), value.length() * sizeof(wchar_t));
pos += maxSize * sizeof(wchar_t);
}
Expand Down

0 comments on commit 708613e

Please sign in to comment.