Inaki,
I am doing updates with avp_db_query, so there is no avp I can check the value of . As I said in a subsequent post, I wrote a simple server that listened on port 3306, like mysql does, and pointed OpenSER at it. The avp_db_query commands() basically blocked forever and openser seemed to completely lose all ability to process new calls. That's really bad.
Doug.
----- Original Message ---- From: Iñaki Baz Castillo ibc@aliax.net To: users@lists.openser.org Sent: Monday, January 14, 2008 1:46:00 PM Subject: Re: [OpenSER-Users] avp_db_query() timeout
El Lunes, 14 de Enero de 2008, Douglas Garstang escribió:
I haven't had much luck getting replies to my questions lately,
hopefully
I'll have more luck with this one.
avp_db_query().... does it have a timeout? What is it? Can I set it?
If I use it, and there is a MySQL database problem, I don't want avp_db_query() to wait forever trying to connect to MySQL. If it
can't
connect after a few seconds, I'd like it to just give up. I have
multiple
calls to avp_db_query() in a typical call flow. It would be even
better if
I could set a flag on the first timeout and not try again during that
call.
Can that be done?
Hi, by the test I've done:
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).
I don't know what occurs if MySQL is running but because overload or any other reason it doesn't reply, but AFAIK the "avp_db_query" uses the same code of other OpenSer functions to access DB, so I'm sure it has a correct behaviour in case of failure.
BTW you can "play" with the $rc code after "avp_db_query".