[SR-Users] avp_db_query => affected rows

Alex Balashov abalashov at evaristesys.com
Mon Jul 15 15:44:21 CEST 2013


On 07/15/2013 09:40 AM, David K wrote:

> Hello,
>
> I want to run an SQL UPDATE command from my kamailio script. I am using
> the command 'avp_db_query'.
>
> How can I get the number of affected rows after the UPDATE runs?

This is a very legacy, obsolete approach to custom SQL query 
interactions.  What you want is to use 'sqlops':

    http://kamailio.org/docs/modules/4.0.x/modules/sqlops.html

It has a nice $sqlrows variable that serves the exact function you're 
looking for:

    5.2. $sqlrows(con)

    Number of affected rows of the previous query on the specified
    connection. It's primary use is to get the number of rows
    affected by UPDATE, INSERT and DELETE queries.

-- Alex

-- 
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States
Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/



More information about the sr-users mailing list