Skip to content

Commit

Permalink
Sketch fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzmbrzl committed Apr 21, 2024
1 parent 8a5ed87 commit 2e8248e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions include/soci/row.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ class SOCI_DECL row

T ret;
type_conversion<T>::move_from_base(baseVal, *indicators_.at(pos), ret);

// Re-initialize the holder in order to be able to use this row object
// for binding to another data set
baseVal = T{};

return ret;
}

Expand Down
4 changes: 4 additions & 0 deletions src/core/row.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,9 @@ blob row::move_as<blob>(std::size_t pos) const

blob ret;
type_conversion<blob>::move_from_base(baseVal, *indicators_.at(pos), ret);

// Re-initialize blob object so it can be used in further queries
baseVal.initialize(session);

return ret;
}
3 changes: 2 additions & 1 deletion tests/common-tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -6779,7 +6779,8 @@ TEST_CASE_METHOD(common_tests, "BLOB", "[core][blob]")
}
SECTION("move_as")
{
soci::rowset< soci::row > rowSet = (sql.prepare << "select b from soci_test where id=:id", soci::use(id));
//soci::rowset< soci::row > rowSet = (sql.prepare << "select b from soci_test where id=:id", soci::use(id));
soci::rowset< soci::row > rowSet = (sql.prepare << "select b from soci_test where id=:id union all select b from soci_test where id=:id", soci::use(id, "id"));
bool containedData = false;
for (auto it = rowSet.begin(); it != rowSet.end(); ++it)
{
Expand Down

0 comments on commit 2e8248e

Please sign in to comment.