Class SessionPool::SessionGuard

Nested Relationships

This class is a nested type of Class SessionPool.

Class Documentation

class SessionGuard

helper class to ensure sessions are always returned

By wrapping the session pool in this class, if something causes the class to go out of scope, this class’s destructor guarantees the session is returned to the pool.

Public Functions

inline SessionGuard(SessionPool *pool)

borrows a session from the pool on construction

inline ~SessionGuard()

when destructed the session is returned

inline std::shared_ptr<mysqlx::Session> get()

returns the session that was borrowed on construction