Skip to content

Commit

Permalink
db_oracle: fix "invalid parameter value" error when do sql_query("upd…
Browse files Browse the repository at this point in the history
…ate ...")
  • Loading branch information
GangZhuo committed Nov 15, 2024
1 parent 1f99823 commit b5133bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 5 additions & 2 deletions modules/db_oracle/dbase.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,15 @@ int db_oracle_free_result(db_con_t* _h, db_res_t* _r)
{
ub4 i;

if (!_h || !_r) {
if (!_h) {
LM_ERR("invalid parameter value\n");
return -1;
}

if (!_r) {
return 0; /* nothing to free */
}

if (RES_NAMES(_r))
for (i=0; i < RES_COL_N(_r); ++i)
if (RES_NAMES(_r)[i]->s)
Expand Down Expand Up @@ -415,7 +419,6 @@ int db_oracle_raw_query(const db_con_t* _h, const str* _s, db_res_t** _r)
return -2;
}
#undef _S_DIFF
if (_r) goto badparam;
cb._rs = NULL;
}

Expand Down
7 changes: 6 additions & 1 deletion modules/db_oracle/res.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,14 @@ int db_oracle_store_result(const db_con_t* _h, db_res_t** _r)
query_data_t *pcb = con->pqdata;


if (!pcb || !pcb->_rs)
if (!pcb)
goto badparam;

if (!pcb->_rs) {
if (_r) *_r = NULL;
return 0; /* No results */
}

hs = *pcb->_rs;
pcb->_rs = NULL; /* paranoid for next call */
}
Expand Down

0 comments on commit b5133bd

Please sign in to comment.