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?
David
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
Hello,
Are you saying that avp_db_query is obsolete?
Thanks for the clarification,
David
On 13-07-15 09:44 AM, Alex Balashov wrote:
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
On 07/15/2013 09:52 AM, David K wrote:
Are you saying that avp_db_query is obsolete?
It's not obsolete in the sense of deprecated, it's just not the most flexible, modern way to access SQL databases. It was the only way to do it before 'sqlops' came along.
Hello,
Thank you for the clarification.
David
On 13-07-15 09:53 AM, Alex Balashov wrote:
On 07/15/2013 09:52 AM, David K wrote:
Are you saying that avp_db_query is obsolete?
It's not obsolete in the sense of deprecated, it's just not the most flexible, modern way to access SQL databases. It was the only way to do it before 'sqlops' came along.
Hello,
Thank you for the clarification.
David
On 13-07-15 09:53 AM, Alex Balashov wrote:
On 07/15/2013 09:52 AM, David K wrote:
Are you saying that avp_db_query is obsolete?
It's not obsolete in the sense of deprecated, it's just not the most flexible, modern way to access SQL databases. It was the only way to do it before 'sqlops' came along.