Class SessionPool#

Nested Relationships#

Nested Types#

Class Documentation#

class SessionPool#

manages a pool of database sessions

This uses a queue object to create a pool of database sessions, to provides for safe multi-threaded access to a MySQL database by returning a unique connection for each request. A mutex and condition variable are used for thread synchronization. A pool of established connections improves performance. Only the session is pooled; the schema and table names must be provided.

Public Functions

SessionPool(const std::string &host, int port, const std::string &user, const std::string &pass)#
~SessionPool()#
void insert(const std::string &schemaname, const std::string &tablename, const std::map<std::string, mysqlx::Value> &data)#
void update(const std::string &schemaname, const std::string &tablename, const std::map<std::string, mysqlx::Value> &data, const std::string &condition, const std::map<std::string, mysqlx::Value> &bindings)#
mysqlx::RowResult read(const std::string &schemaname, const std::string &tablename, const std::vector<std::string> &columns, const std::string &where_clause, const std::map<std::string, mysqlx::Value> &bind_params = {}, const std::string &order_by = "", std::optional<int> limit = std::nullopt, std::optional<int> offset = std::nullopt)#
std::list<std::string> get_tablenames(const std::string &schemaname)#