Browse code

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)

Daniel-Constantin Mierla authored on 04/03/2014 16:31:57
Showing 1 changed files
... ...
@@ -252,6 +252,8 @@ int sql_do_query(sql_con_t *con, str *query, sql_result_t *res)
252 252
 	int i, j;
253 253
 	str sv;
254 254
 
255
+	if(res) sql_reset_result(res);
256
+
255 257
 	if(query==NULL)
256 258
 	{
257 259
 		LM_ERR("bad parameters\n");
... ...
@@ -276,7 +278,6 @@ int sql_do_query(sql_con_t *con, str *query, sql_result_t *res)
276 278
 		return 3;
277 279
 	}
278 280
 
279
-	sql_reset_result(res);
280 281
 	res->ncols = RES_COL_N(db_res);
281 282
 	res->nrows = RES_ROW_N(db_res);
282 283
 	LM_DBG("rows [%d] cols [%d]\n", res->nrows, res->ncols);