| 361 | } |
| 362 | |
| 363 | bool hsclient::query(const char* oper, const char* values[], int num, |
| 364 | const char* limit_offset, char mop, |
| 365 | const char* to_values[], int to_num) |
| 366 | { |
| 367 | acl_assert(tbl_curr_); |
| 368 | |
| 369 | bool retried = false; |
| 370 | |
| 371 | while (true) { |
| 372 | // ������������ |
| 373 | hsproto::build_request(buf_, tbl_curr_->id_, oper, values, |
| 374 | num, limit_offset, mop, to_values, to_num); |
| 375 | |
| 376 | if (debugOn_) { |
| 377 | printf("%s(%d)>>>send: (%s)\n", |
| 378 | __FUNCTION__, __LINE__, buf_.c_str()); |
| 379 | } |
| 380 | |
| 381 | // �����ݿ�ͨ�Ų������ݿ��ý�� |
| 382 | if (chat()) { |
| 383 | break; |
| 384 | } |
| 385 | |
| 386 | // ��������ݿ�ͨ��ʧ�ܵ���������ʱ������Ҳʧ���ش��� |
| 387 | if (retry_enable_ == false || retried) { |
| 388 | close_stream(); |
| 389 | return false; |
| 390 | } |
| 391 | |
| 392 | retried = true; |
| 393 | |
| 394 | // �Ȼ��嵱ǰ���ṹ�е���Ϣ |
| 395 | string dbn(tbl_curr_->dbn_), tbl(tbl_curr_->tbl_); |
| 396 | string idx(tbl_curr_->idx_), flds(tbl_curr_->flds_); |
| 397 | |
| 398 | // �ȹرվɵ����Ӷ������еı����� |
| 399 | close_stream(); |
| 400 | |
| 401 | // �����´����Ӷ������� |
| 402 | if (!open_tbl(dbn.c_str(), tbl.c_str(), idx.c_str(), |
| 403 | flds.c_str(), true)) { |
| 404 | |
| 405 | logger_error("reopen error"); |
| 406 | return (false); |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | if (debugOn_) { |
| 411 | printf("%s(%d): gets: (%s)\n", |
| 412 | __FUNCTION__, __LINE__, buf_.c_str()); |
| 413 | } |
| 414 | return proto_.parse_respond(tbl_curr_->nfld_, buf_, error_, serror_); |
| 415 | } |
| 416 | |
| 417 | bool hsclient::chat(void) |
| 418 | { |
nothing calls this directly
no test coverage detected