IM/MDB/imm_mysqldb/ConnectionPool.h
2023-05-03 19:09:14 +08:00

29 lines
589 B
C++

//
// Created by dongl on 23-4-8.
//
#ifndef IM_CONNECTIONPOOL_H
#define IM_CONNECTIONPOOL_H
#include <mysql++/mysql++.h>
class ConnectionPool : public mysqlpp::ConnectionPool {
public:
ConnectionPool(std::string server, std::string db, std::string user,
std::string password);
~ConnectionPool() override;
protected:
mysqlpp::Connection *create() override;
void destroy(mysqlpp::Connection *connection) override;
unsigned int max_idle_time() override;
private:
std::string server_, db_, user_, password_;
};
#endif //IM_CONNECTIONPOOL_H