| 362 | } |
| 363 | |
| 364 | const char* redis_command::result_value(size_t i, size_t* len /* = NULL */) const |
| 365 | { |
| 366 | if (result_ == NULL || result_->get_type() != REDIS_RESULT_ARRAY) { |
| 367 | return NULL; |
| 368 | } |
| 369 | const redis_result* child = result_->get_child(i); |
| 370 | if (child == NULL) { |
| 371 | return NULL; |
| 372 | } |
| 373 | size_t size = child->get_size(); |
| 374 | if (size == 0) { |
| 375 | return NULL; |
| 376 | } |
| 377 | if (size == 1) { |
| 378 | return child->get(0, len); |
| 379 | } |
| 380 | |
| 381 | // ���ڴ��п��ܱ���Ƭ�ɶ����������С�ڴ� |
| 382 | size = child->get_length(); |
| 383 | size++; |
| 384 | char* buf = (char*) dbuf_->dbuf_alloc(size); |
| 385 | size = child->argv_to_string(buf, size); |
| 386 | if (len) { |
| 387 | *len = size; |
| 388 | } |
| 389 | return buf; |
| 390 | } |
| 391 | |
| 392 | const redis_result* redis_command::get_result() const |
| 393 | { |