2014-11-19 00:06:40 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
#include "acl_cpp/acl_cpp_define.hpp"
|
|
|
|
|
#include <map>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include "acl_cpp/stdlib/string.hpp"
|
|
|
|
|
#include "acl_cpp/stream/socket_stream.hpp"
|
|
|
|
|
#include "acl_cpp/hsocket/hsproto.hpp"
|
|
|
|
|
|
|
|
|
|
struct ACL_ARGV;
|
|
|
|
|
|
|
|
|
|
namespace acl {
|
|
|
|
|
|
|
|
|
|
class hsrow;
|
|
|
|
|
class hstable;
|
|
|
|
|
|
|
|
|
|
class ACL_CPP_API hsclient
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/**
|
|
|
|
|
* <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
|
|
|
|
|
*/
|
|
|
|
|
hsclient(const char* addr, bool cache_enable = true, bool retry_enable = true);
|
|
|
|
|
~hsclient();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <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>
|
|
|
|
|
*/
|
|
|
|
|
const std::vector<hsrow*>& get(const char* values[], int num,
|
|
|
|
|
const char* cond = "=", int nlimit = 0, int noffset = 0);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <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>
|
|
|
|
|
*/
|
|
|
|
|
const std::vector<hsrow*>& get(const char* first_value, ...)
|
|
|
|
|
ACL_CPP_PRINTF(2, 3);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <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>
|
|
|
|
|
*/
|
|
|
|
|
bool mod(const char* values[], int num,
|
|
|
|
|
const char* to_values[], int to_num,
|
|
|
|
|
const char* cond = "=", int nlimit = 0, int noffset = 0);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ɾ<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>
|
|
|
|
|
*/
|
|
|
|
|
bool del(const char* values[], int num, const char* cond = "=",
|
|
|
|
|
int nlimit = 0, int noffset = 0);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ɾ<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>
|
|
|
|
|
*/
|
|
|
|
|
bool fmt_del(const char* first_value, ...) ACL_CPP_PRINTF(2, 3);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <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>
|
|
|
|
|
*/
|
|
|
|
|
bool add(const char* values[], int num);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <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>
|
|
|
|
|
*/
|
|
|
|
|
bool fmt_add(const char* first_value, ...) ACL_CPP_PRINTF(2, 3);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <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>
|
|
|
|
|
*/
|
|
|
|
|
void debug_enable(bool on);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <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>
|
|
|
|
|
*/
|
|
|
|
|
bool open_tbl(const char* dbn, const char* tbl,
|
|
|
|
|
const char* idx, const char* flds, bool auto_open = true);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD>ַ
|
|
|
|
|
* @return {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
const char* get_addr() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {int}
|
|
|
|
|
*/
|
|
|
|
|
int get_error() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <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>
|
|
|
|
|
* @return {const char*}
|
|
|
|
|
*/
|
|
|
|
|
const char* get_serror(int errnum) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴγ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
* @return {const char*}
|
|
|
|
|
*/
|
|
|
|
|
const char* get_last_serror() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ǰ hsclient <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> id <EFBFBD><EFBFBD>
|
|
|
|
|
* @return {int}
|
|
|
|
|
*/
|
|
|
|
|
int get_id() const;
|
|
|
|
|
private:
|
|
|
|
|
bool debugOn_;
|
|
|
|
|
char* addr_;
|
|
|
|
|
hsproto proto_;
|
|
|
|
|
bool retry_enable_;
|
|
|
|
|
int id_max_;
|
|
|
|
|
hstable* tbl_curr_;
|
|
|
|
|
string buf_;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
socket_stream stream_;
|
|
|
|
|
std::map<string, hstable*> tables_;
|
|
|
|
|
|
|
|
|
|
char cond_def_[2];
|
|
|
|
|
int error_;
|
|
|
|
|
const char* serror_;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
bool open_tbl(const char* dbn, const char* tbl,
|
|
|
|
|
const char* idx, const char* flds, const char* key);
|
|
|
|
|
|
|
|
|
|
// <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>
|
|
|
|
|
void close_stream();
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><F2BFAAB5><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD>
|
|
|
|
|
void clear_tables();
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>ݿⷢ<DDBF>Ͳ<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD>ȡ<EEB2A2>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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
|