Browse Source

- some synchronisations with db_postgres driver
- move LAST_ROW incrementation to the end of the function, to only update after
a successfull fetch
- add two debug messages


git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@4138 689a6050-402a-0410-94f2-e92a70836424

Henning Westerholt 17 years ago
parent
commit
bcdd7e7868
2 changed files with 7 additions and 1 deletions
  1. 6 1
      modules/db_mysql/km_dbase.c
  2. 1 0
      modules/db_mysql/km_res.c

+ 6 - 1
modules/db_mysql/km_dbase.c

@@ -323,9 +323,11 @@ int db_mysql_fetch_result(const db_con_t* _h, db_res_t** _r, const int nrows)
 	if(nrows < rows)
 		rows = nrows;
 
-	RES_LAST_ROW(*_r) += rows;
 	RES_ROW_N(*_r) = rows;
 
+	LM_DBG("converting row %d of %d count %d\n", RES_LAST_ROW(*_r),
+			RES_NUM_ROWS(*_r), RES_ROW_N(*_r));
+
 	RES_ROWS(*_r) = (struct db_row*)pkg_malloc(sizeof(db_row_t) * rows);
 	if (!RES_ROWS(*_r)) {
 		LM_ERR("no memory left\n");
@@ -347,6 +349,9 @@ int db_mysql_fetch_result(const db_con_t* _h, db_res_t** _r, const int nrows)
 			return -7;
 		}
 	}
+
+	/* update the total number of rows processed */
+	RES_LAST_ROW(*_r) += rows;
 	return 0;
 }
 

+ 1 - 0
modules/db_mysql/km_res.c

@@ -144,6 +144,7 @@ static inline int db_mysql_convert_rows(const db_con_t* _h, db_res_t* _r)
 
 	RES_ROW_N(_r) = mysql_num_rows(CON_RESULT(_h));
 	if (!RES_ROW_N(_r)) {
+		LM_DBG("no rows returned from the query\n");
 		RES_ROWS(_r) = 0;
 		return 0;
 	}