Project

General

Profile

Actions

Feature #6122

closed

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

Added by Oleg Artenii over 6 years ago. Updated over 6 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}’)
Actions #1

Updated by Roel Standaert over 6 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().

Actions #2

Updated by Oleg Artenii over 6 years ago

I don't copy/move.


I tried different combinations except this:

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

It works. Thank you

[Closed]

Actions #3

Updated by Roel Standaert over 6 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF