Module: sip-router
Branch: 4.1
Commit: 954fe136964296836113f5187f9cde91b197a567
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=954fe13…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Mar 4 17:31:57 2014 +0100
sqlops: reset the result container before new query is executed
- it was lost in commit 9b62514b4a90e169c9126b7bda6d87cc4c213ad2
- reported by Jonas Böttner
(cherry picked from commit 864127e6e02144c40c138d6921862b1512d01c66)
---
modules/sqlops/sql_api.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/modules/sqlops/sql_api.c b/modules/sqlops/sql_api.c
index bfd4e96..2518db1 100644
--- a/modules/sqlops/sql_api.c
+++ b/modules/sqlops/sql_api.c
@@ -252,6 +252,8 @@ int sql_do_query(sql_con_t *con, str *query, sql_result_t *res)
int i, j;
str sv;
+ if(res) sql_reset_result(res);
+
if(query==NULL)
{
LM_ERR("bad parameters\n");
@@ -276,7 +278,6 @@ int sql_do_query(sql_con_t *con, str *query, sql_result_t *res)
return 3;
}
- sql_reset_result(res);
res->ncols = RES_COL_N(db_res);
res->nrows = RES_ROW_N(db_res);
LM_DBG("rows [%d] cols [%d]\n", res->nrows, res->ncols);