diff --git a/include/private/soci-vector-helpers.h b/include/private/soci-vector-helpers.h index c4b2ec270..bcb834b88 100644 --- a/include/private/soci-vector-helpers.h +++ b/include/private/soci-vector-helpers.h @@ -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(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 diff --git a/src/backends/odbc/vector-into-type.cpp b/src/backends/odbc/vector-into-type.cpp index 264e691a7..2f24880bb 100644 --- a/src/backends/odbc/vector-into-type.cpp +++ b/src/backends/odbc/vector-into-type.cpp @@ -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(data_).at(i); if (len == -1) { // Value is null. diff --git a/src/backends/odbc/vector-use-type.cpp b/src/backends/odbc/vector-use-type.cpp index 4dd39e4fe..dea240bec 100644 --- a/src/backends/odbc/vector-use-type.cpp +++ b/src/backends/odbc/vector-use-type.cpp @@ -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(data_).at(i).length(); set_sqllen_from_vector_at(i, static_cast(sz) * sizeof(wchar_t)); maxSize = sz > maxSize ? sz : maxSize; } @@ -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(data_).at(i); std::memcpy(pos, value.c_str(), value.length() * sizeof(wchar_t)); pos += maxSize * sizeof(wchar_t); }