Skip to content

Commit

Permalink
Merge pull request #3504 from GangZhuo/master
Browse files Browse the repository at this point in the history
db_oracle: Fix issues#3505 "invalid parameter value" when do sql_query("update ...")
  • Loading branch information
liviuchircu authored Nov 15, 2024
2 parents 2bc77a5 + b5133bd commit d94c7a8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 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
2 changes: 1 addition & 1 deletion modules/usrloc/dlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static int get_domain_db_ucontacts(udomain_t *d, void *buf, int *len,

i = snprintf(query_buf, sizeof query_buf, "select %.*s, %.*s, %.*s,"
#ifdef ORACLE_USRLOC
" %.*s, %.*s, %.*s from %s where %.*s > %lu and mod(contact_id, %u) = %u",
" %.*s, %.*s, %.*s from %s where %.*s > %lld and mod(contact_id, %u) = %u",
#else
" %.*s, %.*s, %.*s from %s where %.*s > %lld and contact_id %% %u = %u",
#endif
Expand Down

0 comments on commit d94c7a8

Please sign in to comment.