2019-07-28 10:31:56 +08:00
|
|
|
|
#pragma once
|
2017-06-02 14:47:24 +08:00
|
|
|
|
#include "../acl_cpp_define.hpp"
|
2014-11-19 00:25:21 +08:00
|
|
|
|
#include <map>
|
|
|
|
|
#include <vector>
|
2017-06-02 14:47:24 +08:00
|
|
|
|
#include "../stdlib/string.hpp"
|
2019-05-09 13:57:51 +08:00
|
|
|
|
#include "../stdlib/noncopyable.hpp"
|
2017-06-02 14:47:24 +08:00
|
|
|
|
#include "../stream/socket_stream.hpp"
|
|
|
|
|
#include "../hsocket/hsproto.hpp"
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
2019-05-18 21:19:21 +08:00
|
|
|
|
#ifndef ACL_CLIENT_ONLY
|
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
struct ACL_ARGV;
|
|
|
|
|
|
|
|
|
|
namespace acl {
|
|
|
|
|
|
|
|
|
|
class hsrow;
|
|
|
|
|
class hstable;
|
|
|
|
|
|
2019-05-09 13:57:51 +08:00
|
|
|
|
class ACL_CPP_API hsclient : public noncopyable
|
2014-11-19 00:25:21 +08:00
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD>
|
|
|
|
|
* @param addr {const char*} handlersocket <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Mysql <EFBFBD>ϵļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param cache_enable {bool} <EFBFBD>ڲ<EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD>湦<EFBFBD><EFBFBD>
|
|
|
|
|
* @param retry_enable {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD>ʽΪ<EFBFBD><EFBFBD>ip:port
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
hsclient(const char* addr, bool cache_enable = true, bool retry_enable = true);
|
|
|
|
|
~hsclient();
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֵƥ<EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param values {const char*[]} ƥ<EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD>飬<EFBFBD>ֶ<EFBFBD>ֵ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD> open
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> flds <EFBFBD>и<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶε<EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ
|
|
|
|
|
* @param num {int} values <EFBFBD><EFBFBD><EFBFBD>鳤<EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD><EFBFBD><EFBFBD> flds <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>
|
|
|
|
|
* <EFBFBD>ֶθ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param cond {const char*} ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>; >= <EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD>; > <EFBFBD><EFBFBD><EFBFBD><EFBFBD>; < С<EFBFBD><EFBFBD>; <= С<EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param nlimit {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>0 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƹ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param noffset {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼλ<EFBFBD><EFBFBD>(0<EFBFBD><EFBFBD>ʾ<EFBFBD>ӵ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ)
|
|
|
|
|
* @return {const std::verctor<hsrow*>&} <EFBFBD><EFBFBD><EFBFBD>ؽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
const std::vector<hsrow*>& get(const char* values[], int num,
|
|
|
|
|
const char* cond = "=", int nlimit = 0, int noffset = 0);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֵƥ<EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param first_value {const char*} Ϊ<EFBFBD><EFBFBD>Ӧ<EFBFBD>ڹ<EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD><EFBFBD><EFBFBD> flds <EFBFBD>ֶμ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD>ĵ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ֶε<EFBFBD><EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
* @param ... {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ NULL <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const std::verctor<hsrow*>&} <EFBFBD><EFBFBD><EFBFBD>ؽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
const std::vector<hsrow*>& get(const char* first_value, ...)
|
|
|
|
|
ACL_CPP_PRINTF(2, 3);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD>ֶε<EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
* @param values {const char*[]} ƥ<EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD>飬<EFBFBD>ֶ<EFBFBD>ֵ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD> open
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> flds <EFBFBD>и<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶε<EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ
|
|
|
|
|
* @param num {int} values <EFBFBD><EFBFBD><EFBFBD>鳤<EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD><EFBFBD><EFBFBD> flds <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>
|
|
|
|
|
* <EFBFBD>ֶθ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param to_values {cosnt *[]} ƥ<EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֵ<EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD> open <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ
|
|
|
|
|
* @param to_num {int} to_values <EFBFBD><EFBFBD><EFBFBD>鳤<EFBFBD><EFBFBD>
|
|
|
|
|
* @param cond {const char*} ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>; >= <EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD>; > <EFBFBD><EFBFBD><EFBFBD><EFBFBD>; < С<EFBFBD><EFBFBD>; <= С<EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param nlimit {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>0 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƹ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param noffset {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼλ<EFBFBD><EFBFBD>(0<EFBFBD><EFBFBD>ʾ<EFBFBD>ӵ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ)
|
|
|
|
|
* @return {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
bool mod(const char* values[], int num,
|
|
|
|
|
const char* to_values[], int to_num,
|
|
|
|
|
const char* cond = "=", int nlimit = 0, int noffset = 0);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD>ֶεļ<EFBFBD>¼
|
|
|
|
|
* @param values {const char*[]} ƥ<EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD>飬<EFBFBD>ֶ<EFBFBD>ֵ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD> open
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> flds <EFBFBD>и<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶε<EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ
|
|
|
|
|
* @param num {int} values <EFBFBD><EFBFBD><EFBFBD>鳤<EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD><EFBFBD><EFBFBD> flds <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>
|
|
|
|
|
* <EFBFBD>ֶθ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param cond {const char*} ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* = <EFBFBD><EFBFBD><EFBFBD><EFBFBD>; >= <EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD>; > <EFBFBD><EFBFBD><EFBFBD><EFBFBD>; < С<EFBFBD><EFBFBD>; <= С<EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param nlimit {int} ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵĸ<EFBFBD><EFBFBD><EFBFBD>, 0 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param noffset {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼλ<EFBFBD><EFBFBD>(0<EFBFBD><EFBFBD>ʾ<EFBFBD>ӵ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ)
|
|
|
|
|
* @return {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
bool del(const char* values[], int num, const char* cond = "=",
|
|
|
|
|
int nlimit = 0, int noffset = 0);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD><EFBFBD>ֶεļ<EFBFBD>¼
|
|
|
|
|
* @param first_value {const char*} Ϊ<EFBFBD><EFBFBD>Ӧ<EFBFBD>ڹ<EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD><EFBFBD><EFBFBD> flds <EFBFBD>ֶμ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD>ĵ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ֶε<EFBFBD><EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
* @param ... {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ NULL <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {bool} <EFBFBD><EFBFBD><EFBFBD>Ӽ<EFBFBD>¼<EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
bool fmt_del(const char* first_value, ...) ACL_CPP_PRINTF(2, 3);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>¼
|
|
|
|
|
* @param values {const char*[]} ƥ<EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD>飬<EFBFBD>ֶ<EFBFBD>ֵ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD>Ӧ<EFBFBD>빹<EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> flds <EFBFBD>и<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶε<EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ
|
|
|
|
|
* @param num {int} values <EFBFBD><EFBFBD><EFBFBD>鳤<EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD><EFBFBD><EFBFBD> flds <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>
|
|
|
|
|
* <EFBFBD>ֶθ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {bool} <EFBFBD><EFBFBD><EFBFBD>Ӽ<EFBFBD>¼<EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
bool add(const char* values[], int num);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>¼
|
|
|
|
|
* @param first_value {const char*} Ϊ<EFBFBD><EFBFBD>Ӧ<EFBFBD>ڹ<EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD><EFBFBD><EFBFBD> flds <EFBFBD>ֶμ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD>ĵ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ֶε<EFBFBD><EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
* @param ... {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ NULL <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {bool} <EFBFBD><EFBFBD><EFBFBD>Ӽ<EFBFBD>¼<EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
bool fmt_add(const char* first_value, ...) ACL_CPP_PRINTF(2, 3);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param on {bool} true <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD>ԣ<EFBFBD><EFBFBD>ὫһЩ<EFBFBD>м<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
void debug_enable(bool on);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param dbn {const char*} <EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param tbl {const char*} <EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param idx {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param flds {const char*} Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><EFBFBD><EFBFBD>ʽΪ
|
|
|
|
|
* <EFBFBD>ɷָ<EFBFBD><EFBFBD><EFBFBD> ",; \t" <EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><EFBFBD>磺user_id,user_name,user_mail
|
|
|
|
|
* @param auto_open {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {bool} true <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
bool open_tbl(const char* dbn, const char* tbl,
|
|
|
|
|
const char* idx, const char* flds, bool auto_open = true);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>ַ
|
|
|
|
|
* @return {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
const char* get_addr() const;
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @return {int}
|
|
|
|
|
*/
|
|
|
|
|
int get_error() const;
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param errnum {int} <EFBFBD><EFBFBD> get_error <EFBFBD><EFBFBD><EFBFBD>õĴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @return {const char*}
|
|
|
|
|
*/
|
|
|
|
|
const char* get_serror(int errnum) const;
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴγ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @return {const char*}
|
|
|
|
|
*/
|
|
|
|
|
const char* get_last_serror() const;
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ǰ hsclient <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> id <EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @return {int}
|
|
|
|
|
*/
|
|
|
|
|
int get_id() const;
|
|
|
|
|
private:
|
|
|
|
|
bool debugOn_;
|
|
|
|
|
char* addr_;
|
|
|
|
|
hsproto proto_;
|
|
|
|
|
bool retry_enable_;
|
|
|
|
|
int id_max_;
|
|
|
|
|
hstable* tbl_curr_;
|
|
|
|
|
string buf_;
|
|
|
|
|
|
2019-07-28 10:31:56 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
socket_stream stream_;
|
|
|
|
|
std::map<string, hstable*> tables_;
|
|
|
|
|
|
|
|
|
|
char cond_def_[2];
|
|
|
|
|
int error_;
|
|
|
|
|
const char* serror_;
|
|
|
|
|
|
2019-07-28 10:31:56 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
bool open_tbl(const char* dbn, const char* tbl,
|
|
|
|
|
const char* idx, const char* flds, const char* key);
|
|
|
|
|
|
2019-07-28 10:31:56 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>Ҫ<EFBFBD><D2AA><EFBFBD>ô˺<C3B4><CBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
void close_stream();
|
|
|
|
|
|
2019-07-28 10:31:56 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><F2BFAAB5><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
void clear_tables();
|
|
|
|
|
|
2019-07-28 10:31:56 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ݿⷢ<DDBF>Ͳ<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD>ȡ<EEB2A2>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
bool query(const char* oper, const char* values[], int num,
|
|
|
|
|
const char* limit_offset, char mop,
|
|
|
|
|
const char* to_values[], int to_num);
|
|
|
|
|
bool chat();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace acl
|
2019-05-18 21:19:21 +08:00
|
|
|
|
|
|
|
|
|
#endif // ACL_CLIENT_ONLY
|