注: 本文档主要根据原作者的英文文档protocol.en.txt写成,做了一些翻译工作和添加了一些例子以及一些需要注意的地方。如果本文档对你有所帮助,欢迎关注我的新浪微博:http://weibo.com/u/1857063732 如果有建议,欢迎发送到我的邮箱[email protected] 目前就职于 欢聚时代(YY), 从事于后台开发工作。
Openingindex
英文原文如下
Openingindex
The'open_index' request has the following syntax.
P
-
-
key, use PRIMARY as
-
-
optional.
Oncean 'open_index' request is issued, the HandlerSocket plugin opens the
specifiedindex and keep it open until the client connection is closed. Each
openindex is identified by
openindex is closed. You can open the same combination of
Forefficiency, keep
打开索引
‘open_index’有以下参数:
P
-
-
-
-
当‘open_index’请求执行后,handlersocket插件就会打开所指定的索引并且一直保持打开状态直到这个客户端的连接关闭。每一个打开的索引都被一个
Responsefor 'open_index'
If'open_index' is succeeded, HandlerSocket returns a line of the following
syntax.
0 1
‘open_index’请求的返回:
如果'open_index'请求发送成功,HandlerSocket 会返回0(成功)或1(失败);
所使用的成员函数的原型:
virtual void request_buf_open_index(size_t pst_id, const char *dbn,
const char *tbl, constchar *idx, const char *retflds,
const char *filflds = 0) =0;
举几个例子说明:
数据库中 add index index1 (col1,col2....)
hstcpcli_ptr cli =hstcpcli_i::create(sock_args);
cli->request_buf_open_index(indexid,"test", "test1", "index1","col1,col2,col3,col4");
do { //发送request_buf_open_index请求
if(cli->request_send() != 0) {
fprintf(stderr, "request_send:%s\n", cli->get_error().c_str());
break;
}
if ((code = cli->response_recv(numflds)) != 0) {
fprintf(stderr, "response_recv:%s\n", cli->get_error().c_str());
break;
}
}while (false);
cli->response_buf_remove();
也可以使用
如:
cli->request_buf_open_index(indexid,"test", "test1", "index1","col1,col2,col3,col4","col5,col6");
(其中col1,col2...均为列名)