Skip to content

Commit

Permalink
Remove statement::define_for_row() and call it from describe()
Browse files Browse the repository at this point in the history
It looks like this function must always be called after a (successful)
call to describe() and it is not called from anywhere else, so it seems
wrong to both require and allow calling it independently -- just call it
from describe() itself.

No real changes, this function has never been part of public API, so
hopefully nobody was using it.
  • Loading branch information
vadz committed Nov 17, 2024
1 parent 48a5a6c commit c899bc6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
1 change: 0 additions & 1 deletion include/soci/statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ class SOCI_DECL statement_impl
void exchange_for_row(into_container<T, Indicator> const &ic)
{ intosForRow_.exchange(ic); }
void exchange_for_row(into_type_ptr const & i) { intosForRow_.exchange(i); }
void define_for_row();

template<typename T>
void into_row()
Expand Down
19 changes: 8 additions & 11 deletions src/core/statement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,6 @@ void statement_impl::define_and_bind()
}
}

void statement_impl::define_for_row()
{
std::size_t const isize = intosForRow_.size();
for (std::size_t i = 0; i != isize; ++i)
{
intosForRow_[i]->define(*this, definePositionForRow_);
}
}

void statement_impl::undefine_and_bind()
{
std::size_t const isize = intos_.size();
Expand Down Expand Up @@ -298,7 +289,6 @@ bool statement_impl::execute(bool withDataExchange)
if (row_ != NULL && alreadyDescribed_ == false)
{
describe();
define_for_row();
}

int num = 0;
Expand Down Expand Up @@ -330,7 +320,6 @@ bool statement_impl::execute(bool withDataExchange)
if (row_ != NULL && alreadyDescribed_ == false)
{
describe();
define_for_row();
}

bool gotData = false;
Expand Down Expand Up @@ -787,6 +776,14 @@ void statement_impl::describe()
}

alreadyDescribed_ = true;

// Calling bind_into() above could have added row into elements, so
// initialize them.
std::size_t const isize = intosForRow_.size();
for (std::size_t i = 0; i != isize; ++i)
{
intosForRow_[i]->define(*this, definePositionForRow_);
}
}

} // namespace details
Expand Down

0 comments on commit c899bc6

Please sign in to comment.