[OpenSIPS-Users] PATCH: avp_db_query() return codes
John Khvatov
ivaxer at gmail.com
Mon Feb 28 16:32:26 CET 2011
Hello all.
I wrote a small patch for avpops module:
http://dev.sgu.ru/pub/0001-avp_db_query-improved-error-reporting.patch
Current implementation of avp_db_query returns -1 on internal error or empty result. Thus, current function interface does not allow to write script with storage error handling.
Patched avp_db_query() returns:
-3 on internal error
-1 on empty result
1 on success
With patched avp_db_query() we can write following logic in opensips.cfg:
avp_db_query("SELECT 1 WHERE false", "$avp(s:name)")
if ($retcode == -3) {
xlog("Error while querying database. Handle error.");
}
else if ($retcode == -1) {
xlog("Handle empty result.");
}
else {
xlog("Handle result");
}
I've tested this patch with 1.6.4.
Please, review my patch and apply to upstream.
--
WBR, John Khvatov
More information about the Users
mailing list