[OpenSIPS-Users] MySQL LAST_INSERT_ID() safe?

Bogdan-Andrei Iancu bogdan at voice-system.ro
Tue Nov 30 21:21:00 CET 2010


Hi Chris,

It is safe, as opensips has a mysql connection for each process and a 
script route is continuously executed by a single process.  So your 
queries will go via same connection with no risk to have something else 
between.

Regards,
Bogdan

Chris Maciejewski wrote:
> Hi,
>
> I am trying to figure out if is it safe to use in OpenSIPs config file:
>
> avp_db_query("INSERT INTO some_table VALUES ('data1')");
> avp_db_query("SELECT LAST_INSERT_ID()","$avp(last_id);");
>
> // do stuff with $avp(last_id);
>
> How does OpenSIPs connects to MySQL sever? Does it use some smart
> connection pooling maybe, which could result in unexpected behaviour?
>
> Regards,
> Chris
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>   


-- 
Bogdan-Andrei Iancu
OpenSIPS Bootcamp
15 - 19 November 2010, Edison, New Jersey, USA
www.voice-system.ro




More information about the Users mailing list