Skip to content

Commit b5133bd

Browse files
committed
db_oracle: fix "invalid parameter value" error when do sql_query("update ...")
1 parent 1f99823 commit b5133bd

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

modules/db_oracle/dbase.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,15 @@ int db_oracle_free_result(db_con_t* _h, db_res_t* _r)
189189
{
190190
ub4 i;
191191

192-
if (!_h || !_r) {
192+
if (!_h) {
193193
LM_ERR("invalid parameter value\n");
194194
return -1;
195195
}
196196

197+
if (!_r) {
198+
return 0; /* nothing to free */
199+
}
200+
197201
if (RES_NAMES(_r))
198202
for (i=0; i < RES_COL_N(_r); ++i)
199203
if (RES_NAMES(_r)[i]->s)
@@ -415,7 +419,6 @@ int db_oracle_raw_query(const db_con_t* _h, const str* _s, db_res_t** _r)
415419
return -2;
416420
}
417421
#undef _S_DIFF
418-
if (_r) goto badparam;
419422
cb._rs = NULL;
420423
}
421424

modules/db_oracle/res.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,14 @@ int db_oracle_store_result(const db_con_t* _h, db_res_t** _r)
457457
query_data_t *pcb = con->pqdata;
458458

459459

460-
if (!pcb || !pcb->_rs)
460+
if (!pcb)
461461
goto badparam;
462462

463+
if (!pcb->_rs) {
464+
if (_r) *_r = NULL;
465+
return 0; /* No results */
466+
}
467+
463468
hs = *pcb->_rs;
464469
pcb->_rs = NULL; /* paranoid for next call */
465470
}

0 commit comments

Comments
 (0)