Project

General

Profile

Feature #6122

Compare == operator for Wt::Dbo::Session

Added by Oleg Artenii about 5 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
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}’)
#1

Updated by Roel Standaert about 5 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().

#2

Updated by Oleg Artenii about 5 years ago

I don't copy/move.


I tried different combinations except this:

&transaction.session() == mConnection.get()

It works. Thank you

[Closed]

#3

Updated by Roel Standaert about 5 years ago

  • Status changed from New to Closed

Also available in: Atom PDF