Module: sip-router
Branch: 3.3
Commit: c1a4dda1b7a364a4ef0060f85b3d192993373d2e
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c1a4dda…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Mar 4 17:43:21 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)
(cherry picked from commit 954fe136964296836113f5187f9cde91b197a567)
---
modules_k/sqlops/sql_api.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/modules_k/sqlops/sql_api.c b/modules_k/sqlops/sql_api.c
index c4c05dc..84af170 100644
--- a/modules_k/sqlops/sql_api.c
+++ b/modules_k/sqlops/sql_api.c
@@ -250,6 +250,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");
@@ -274,7 +276,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);