From 2e4b44b9fabc65a2362d6421c78fab35b1552717 Mon Sep 17 00:00:00 2001 From: Carsten Stiborg Date: Mon, 9 Oct 2023 15:32:50 +0000 Subject: [PATCH] Disallow constructing rowset from a session This doesn't make sense, so explicitly delete the ctor from session to prevent such code from compiling. Closes #1081. See #1082. --- include/soci/rowset.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/soci/rowset.h b/include/soci/rowset.h index cfe5ca2b4..afd5cf3f9 100644 --- a/include/soci/rowset.h +++ b/include/soci/rowset.h @@ -182,6 +182,12 @@ class rowset pimpl_->incRef(); } + // Due to the existence of conversion from session to prepare_temp_type, it + // would have been possible to construct a rowset from session if we didn't + // delete this ctor -- so do delete it because it doesn't make sense to + // provide such constructor. + rowset(session const& session) = delete; + ~rowset() { pimpl_->decRef();