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?
Doug.
____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
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") - ...
On Tuesday 15 January 2008, Douglas Garstang wrote:
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!!!
Hi Douglas,
i did a short look at the code, and it really should return 1 on success, as stated from Iñaki too. Strange.
Cheers,
Henning
On Wednesday 16 January 2008 11:00:44 Henning Westerholt wrote:
On Tuesday 15 January 2008, Douglas Garstang wrote:
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!!!
Hi Douglas,
i did a short look at the code, and it really should return 1 on success, as stated from Iñaki too. Strange.
I think that is the SQL query is not a SELECT then the reply is always -1 (but not sure of this, should try).