29 lines
589 B
C++
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
|