MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / resume_async_sqlquery

Function resume_async_sqlquery

modules/sqlops/sqlops_impl.c:1036–1083  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1034}
1035
1036int resume_async_sqlquery(int fd, struct sip_msg *msg, void *_param)
1037{
1038 db_res_t *res = NULL;
1039 query_async_param *param = (query_async_param *)_param;
1040 int rc, ret;
1041
1042 rc = param->dbf->async_resume(param->hdl, fd, &res, param->db_param);
1043 if (async_status == ASYNC_CONTINUE || async_status == ASYNC_CHANGE_FD) {
1044 return rc;
1045 }
1046
1047 if (rc != 0) {
1048 LM_ERR("async query returned error\n");
1049 ret = -1;
1050 goto err_free;
1051 }
1052
1053 if (!res || RES_ROW_N(res) <= 0 || RES_COL_N(res) <= 0) {
1054 LM_DBG("query returned no results\n");
1055 ret = -2;
1056 goto err_free;
1057 }
1058
1059 if (param->one_row) {
1060 if (db_query_print_one_result(msg, res, param->output_avps) != 0) {
1061 LM_ERR("failed to print ONE result\n");
1062 ret = -1;
1063 goto err_free;
1064 }
1065 } else {
1066 if (db_query_print_results(msg, res, param->output_avps) != 0) {
1067 LM_ERR("failed to print results\n");
1068 ret = -1;
1069 goto err_free;
1070 }
1071 }
1072
1073 async_status = ASYNC_DONE;
1074
1075 param->dbf->async_free_result(param->hdl, res, param->db_param);
1076 pkg_free(param);
1077 return 1;
1078
1079err_free:
1080 param->dbf->async_free_result(param->hdl, res, param->db_param);
1081 pkg_free(param);
1082 return ret;
1083}
1084

Callers

nothing calls this directly

Calls 2

db_query_print_resultsFunction · 0.85

Tested by

no test coverage detected