Skip to content

Commit d94c7a8

Browse files
authored
Merge pull request #3504 from GangZhuo/master
db_oracle: Fix issues#3505 "invalid parameter value" when do sql_query("update ...")
2 parents 2bc77a5 + b5133bd commit d94c7a8

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
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
}

modules/usrloc/dlist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static int get_domain_db_ucontacts(udomain_t *d, void *buf, int *len,
151151

152152
i = snprintf(query_buf, sizeof query_buf, "select %.*s, %.*s, %.*s,"
153153
#ifdef ORACLE_USRLOC
154-
" %.*s, %.*s, %.*s from %s where %.*s > %lu and mod(contact_id, %u) = %u",
154+
" %.*s, %.*s, %.*s from %s where %.*s > %lld and mod(contact_id, %u) = %u",
155155
#else
156156
" %.*s, %.*s, %.*s from %s where %.*s > %lld and contact_id %% %u = %u",
157157
#endif

0 commit comments

Comments
 (0)