Skip to content

Commit

Permalink
Merge pull request #1207 from dronord/ora_fetch
Browse files Browse the repository at this point in the history
fix and optimize oracle fetch
(cherry picked from commit f7e45ba)
  • Loading branch information
bogdan-iancu committed May 28, 2019
1 parent ab79540 commit 1b5702a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion modules/db_oracle/res.c
Expand Up @@ -373,7 +373,7 @@ static int get_rows(ora_con_t* con, db_res_t* _r, OCIStmt* _c, dmap_t* _d)
// timelimited operation
status = begin_timelimit(con, 0);
if (status != OCI_SUCCESS) goto ora_err;
do status = OCIStmtFetch2(_c, con->errhp, 1, OCI_FETCH_NEXT, 0,
do status = OCIStmtFetch2(_c, con->errhp, 1, OCI_FETCH_LAST, 0,
OCI_DEFAULT);
while (wait_timelimit(con, status));
if (done_timelimit(con, status)) goto stop_load;
Expand All @@ -394,6 +394,13 @@ static int get_rows(ora_con_t* con, db_res_t* _r, OCIStmt* _c, dmap_t* _d)
goto stop_load;
}

if (rcnt > 5) {
ub4 prefetch = rcnt/5;
status = OCIAttrSet(_c, OCI_HTYPE_STMT, &prefetch, 0,
OCI_ATTR_PREFETCH_ROWS, con->errhp);
if (status != OCI_SUCCESS) goto ora_err;
}

RES_ROW_N(_r) = rcnt;
if (db_allocate_rows( _r, rcnt)!=0) {
LM_ERR("no private memory left\n");
Expand Down

0 comments on commit 1b5702a

Please sign in to comment.