Actions
Feature #6122
closed
OA
Compare == operator for Wt::Dbo::Session
Feature #6122:
Compare == 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}’)
RS Updated by Roel Standaert almost 9 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().
OA Updated by Oleg Artenii almost 9 years ago
RS Updated by Roel Standaert almost 9 years ago
- Status changed from New to Closed
Actions