Actions
Feature #6122
closedCompare == operator for Wt::Dbo::Session
Start date:
11/13/2017
Due date:
% Done:
0%
Estimated time:
Description
My app can have multiple db connections. For performance and data integrity reasons I allow combination of different class queries in a single transaction. The transaction is passed by reference.
Long story short: I just need to compare if the transaction passed by reference is linked to the same db connection/session of the current class.
#include <gsl/gsl_assert>
...
private:
std::shared_ptr<Wt::Dbo::Session> mConnection;
};
...
Expects(transaction.session() == *mConnection.get());
error: no match for ‘operator==’ (operand types are ‘Wt::Dbo::Session’ and ‘Wt::Dbo::Session’)
error: no match for ‘operator==’ (operand types are ‘Wt::Dbo::Session’ and ‘std::__shared_ptr<Wt::Dbo::Session, (__gnu_cxx::_Lock_policy)2>::element_type {aka Wt::Dbo::Session}’)
Updated by Roel Standaert about 7 years ago
A session is not copyable nor movable, so unless I did not understand you correctly, you should be able to use reference equality to compare sessions, i.e. &transaction.session() == mConnection.get()
.
Updated by Oleg Artenii about 7 years ago
I don't copy/move.
I tried different combinations except this:
&transaction.session() == mConnection.get()
It works. Thank you
[Closed]
Actions