---------------------
PatchSet 3 
Date: 2005/06/20 11:26:58
Author: jhoblitt
Branch: HEAD
Tag: (none) 
Log:
change psDBUpdateRows() & psDBDeleteRows() to check the affected row count before a commit

Members: 
	src/dataIO/psDB.c:1.1->1.2 

Index: src/dataIO/psDB.c
===================================================================
RCS file: /tmp/cvsroot/pslib/src/dataIO/psDB.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- src/dataIO/psDB.c	20 Jun 2005 21:22:59 -0000	1.1
+++ src/dataIO/psDB.c	20 Jun 2005 21:26:58 -0000	1.2
@@ -758,11 +758,12 @@ psS64 psDBUpdateRows(psDB *dbh, const ch
 
     psFree(bind);
 
+    // mysql_stmt_affected_rows() must be called before a commit
+    rowsAffected = mysql_stmt_affected_rows(stmt);
+
     // point of no return
     mysql_commit(dbh->mysql);
 
-    rowsAffected = mysql_stmt_affected_rows(stmt);
-
     mysql_stmt_close(stmt);
 
     return rowsAffected;
@@ -771,6 +772,7 @@ psS64 psDBUpdateRows(psDB *dbh, const ch
 psS64 psDBDeleteRows(psDB *dbh, const char *tableName, psMetadata *where)
 {
     char            *query;
+    unsigned long   rowsAffected;
 
     query = psDBGenerateDeleteRowSQL(tableName, where);
     if (!query) {
@@ -796,10 +798,13 @@ psS64 psDBDeleteRows(psDB *dbh, const ch
         return 1;
     }
 
+    // mysql_affected_rows() must be called before a commit
+    rowsAffected = (psS64)mysql_affected_rows(dbh->mysql);
+
     // point of no return
     mysql_commit(dbh->mysql);
 
-    return (psS64)mysql_affected_rows(dbh->mysql);
+    return rowsAffected;
 }
 
 // database utility functions
