El Martes, 15 de Enero de 2008, Douglas Garstang escribió:
What's the point of the pseudo variable $rc?
If I use avp_db_query() with: invalid SQL, then rc = -1. database down: then rc = -1. Everything fine... then rc = -1!!!
What's the point?
avp_db_query("SQL_QUERY", "$avp(s:result)"); xlog("L_INFO", "retcode = $rc \n");
Cases:
- If query doesn't return a row/value then $avp(s:result)=null and $rc=(-1).
- If query returns a row/value the $avp(s_result) stores that value and $rc=1.
- If there is a syntax error in query then $avp(s:result)=null and $rc=(-1).
- If MySQL is not running then $avp(s:result)=null and $rc=(-1).
You can also check $rc after lots of functions as: - loose_route() - is_from_local() - is_uri_host_local() - force_rtp_proxy("l") <-- Vry useful for applying tpProxy in sequential INVITE just if it was applied in the initial INVITE. - sd_lookup() - cpl_run_script() - lookup("location") - ...