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


_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to