2015-08-12 16:48:24 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
#include "acl_cpp/acl_cpp_define.hpp"
|
|
|
|
|
#include "acl_cpp/connpool/connect_manager.hpp"
|
|
|
|
|
|
|
|
|
|
namespace acl {
|
|
|
|
|
|
|
|
|
|
class ACL_CPP_API sqlite_manager : public connect_manager
|
|
|
|
|
{
|
|
|
|
|
public:
|
2015-10-25 14:15:07 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD>
|
|
|
|
|
* @param charset {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
sqlite_manager(const char* charset = "utf-8");
|
2015-08-12 16:48:24 +08:00
|
|
|
|
~sqlite_manager();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param dbfile {const char*} sqlite <EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
2015-08-14 17:28:30 +08:00
|
|
|
|
* @param dblimit {size_t} <EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2015-08-12 16:48:24 +08:00
|
|
|
|
* @return {sqlite_manager&}
|
|
|
|
|
*/
|
2015-08-14 17:28:30 +08:00
|
|
|
|
sqlite_manager& add(const char* dbfile, size_t dblimit);
|
2015-08-12 16:48:24 +08:00
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> connect_manager <EFBFBD>麯<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param addr {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>ip:port
|
2015-09-27 20:59:21 +08:00
|
|
|
|
* @param count {size_t} <EFBFBD><EFBFBD><EFBFBD>ӳصĴ<EFBFBD>С<EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><EFBFBD><EFBFBD>ֵΪ 0 ʱû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2015-08-12 16:48:24 +08:00
|
|
|
|
* @param idx {size_t} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳض<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD>±<EFBFBD>λ<EFBFBD><EFBFBD>(<EFBFBD><EFBFBD> 0 <EFBFBD><EFBFBD>ʼ)
|
|
|
|
|
* @return {connect_pool*} <EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳض<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
2015-08-14 17:28:30 +08:00
|
|
|
|
connect_pool* create_pool(const char* addr, size_t count, size_t idx);
|
2015-08-12 16:48:24 +08:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
// sqlite <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
|
|
|
|
char* dbfile_;
|
2015-10-25 14:15:07 +08:00
|
|
|
|
char* charset_;
|
2015-08-14 17:28:30 +08:00
|
|
|
|
size_t dblimit_;
|
2015-08-12 16:48:24 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace acl
|