Skip to content

Commit

Permalink
change is_char_array_v to iguana::array_v
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacyking committed Jun 18, 2024
1 parent c75cc00 commit 9718927
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ormpp/mysql.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class mysql {
}
else if constexpr (iguana::array_v<U>) {
auto &vec = mp[i];
memcpy(value, vec.data(), vec.size());
memcpy(value.data(), vec.data(), value.size());
}
else if constexpr (std::is_same_v<blob, U>) {
auto &vec = mp[i];
Expand Down
6 changes: 5 additions & 1 deletion ormpp/postgresql.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ class postgresql {
sprintf(temp.data(), "%f", value);
param_values.push_back(std::move(temp));
}
else if constexpr (iguana::array_v<U> || std::is_same_v<std::string, U>) {
else if constexpr (std::is_same_v<std::string, U>) {
std::vector<char> temp = {};
std::copy(value.data(), value.data() + value.size() + 1,
std::back_inserter(temp));
Expand All @@ -719,6 +719,10 @@ class postgresql {
std::copy(value, value + sizeof(U), std::back_inserter(temp));
param_values.push_back(std::move(temp));
}
else if constexpr (iguana::array_v<U>) {
auto p = PQgetvalue(res_, row, i);
memcpy(value.data(), p, value.size());
}
else {
static_assert(!sizeof(U), "this type has not supported yet");
}
Expand Down

0 comments on commit 9718927

Please sign in to comment.