From b225eeff2c2255bb60e38e90b7386db0a8068d01 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 28 Nov 2017 13:38:44 +0200 Subject: [PATCH] MXS-1512 Allow autocommit and trx state to be set for a session When mocking you want to be able to set explicitly how a filter session should see the current context. --- .../filter/test/maxscale/mock/session.hh | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/server/modules/filter/test/maxscale/mock/session.hh b/server/modules/filter/test/maxscale/mock/session.hh index a439ffa82..0c1fc6175 100644 --- a/server/modules/filter/test/maxscale/mock/session.hh +++ b/server/modules/filter/test/maxscale/mock/session.hh @@ -33,6 +33,8 @@ class Session : public MXS_SESSION Session& operator = (Session&); public: + typedef mxs_session_trx_state_t trx_state_t; + /** * Constructor * @@ -44,6 +46,26 @@ public: Client& client() const; + bool is_autocommit() const + { + return session_is_autocommit(this); + } + + void set_autocommit(bool autocommit) + { + session_set_autocommit(this, autocommit); + } + + trx_state_t trx_state() const + { + return session_get_trx_state(this); + } + + void set_trx_state(trx_state_t state) + { + session_set_trx_state(this, state); + } + private: Client& m_client; Dcb m_client_dcb;