MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / cdb2_next_record

Function cdb2_next_record

cdb2api/cdb2api.c:3440–3493  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3438}
3439
3440int cdb2_next_record(cdb2_hndl_tp *hndl)
3441{
3442 int rc = 0;
3443
3444 void *callbackrc;
3445 int overwrite_rc = 0;
3446 cdb2_event *e = NULL;
3447
3448 if (hndl->fdb_hndl)
3449 hndl = hndl->fdb_hndl;
3450
3451 while ((e = cdb2_next_callback(hndl, CDB2_AT_ENTER_NEXT_RECORD, e)) !=
3452 NULL) {
3453 callbackrc = cdb2_invoke_callback(hndl, e, 0);
3454 PROCESS_EVENT_CTRL_BEFORE(hndl, e, rc, callbackrc, overwrite_rc);
3455 }
3456
3457 if (overwrite_rc)
3458 goto after_callback;
3459
3460 if (hndl->in_trans && !hndl->read_intrans_results && !hndl->is_read) {
3461 rc = CDB2_OK_DONE;
3462 } else if (hndl->lastresponse && hndl->first_record_read == 0) {
3463 hndl->first_record_read = 1;
3464 if (hndl->lastresponse->response_type == RESPONSE_TYPE__COLUMN_VALUES ||
3465 hndl->lastresponse->response_type == RESPONSE_TYPE__SQL_ROW) {
3466 rc = hndl->lastresponse->error_code;
3467 } else if (hndl->lastresponse->response_type ==
3468 RESPONSE_TYPE__LAST_ROW) {
3469 if (hndl->num_set_commands) {
3470 hndl->num_set_commands_sent = hndl->num_set_commands;
3471 }
3472 rc = CDB2_OK_DONE;
3473 } else {
3474 rc = -1;
3475 }
3476 } else {
3477 rc = cdb2_next_record_int(hndl, 1);
3478 }
3479
3480 if (log_calls)
3481 fprintf(stderr, "%p> cdb2_next_record(%p) = %d\n",
3482 (void *)pthread_self(), hndl, rc);
3483
3484after_callback:
3485 while ((e = cdb2_next_callback(hndl, CDB2_AT_EXIT_NEXT_RECORD, e)) !=
3486 NULL) {
3487 callbackrc =
3488 cdb2_invoke_callback(hndl, e, 1, CDB2_RETURN_VALUE, (intptr_t)rc);
3489 PROCESS_EVENT_CTRL_AFTER(hndl, e, rc, callbackrc);
3490 }
3491
3492 return rc;
3493}
3494
3495int cdb2_get_effects(cdb2_hndl_tp *hndl, cdb2_effects_tp *effects)
3496{

Callers 15

db_generatorFunction · 0.85
run_statementFunction · 0.85
run_queryMethod · 0.85
get_portsMethod · 0.85
last_costFunction · 0.85
replayFunction · 0.85
find_match_lsnFunction · 0.85
insert_records_thdFunction · 0.85
update_records_thdFunction · 0.85
record_countFunction · 0.85
select_and_update_orphanFunction · 0.85
select_and_updateFunction · 0.85

Calls 3

cdb2_next_callbackFunction · 0.85
cdb2_invoke_callbackFunction · 0.85
cdb2_next_record_intFunction · 0.85

Tested by 12

masterFunction · 0.68
read_nodeFunction · 0.68
mainFunction · 0.68
updaterFunction · 0.68
mainFunction · 0.68
test_next_recordFunction · 0.68
test_bind_blob_arrayFunction · 0.68
test_pass_array_to_spFunction · 0.68
test_bind_array_in_spFunction · 0.68
run_statementFunction · 0.68
mainFunction · 0.68
test_register_timeoutFunction · 0.68