IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ticket #442: pslib-0.6.0-affected_rows.patch

File pslib-0.6.0-affected_rows.patch, 1.6 KB (added by jhoblitt, 21 years ago)

change psDBUpdateRows() & psDBDeleteRows() to check the affected row count before a commit

  • src/dataIO/psDB.c

    ---------------------
    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 
    
    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
    psS64 psDBUpdateRows(psDB *dbh, const ch  
    758758
    759759    psFree(bind);
    760760
     761    // mysql_stmt_affected_rows() must be called before a commit
     762    rowsAffected = mysql_stmt_affected_rows(stmt);
     763
    761764    // point of no return
    762765    mysql_commit(dbh->mysql);
    763766
    764     rowsAffected = mysql_stmt_affected_rows(stmt);
    765 
    766767    mysql_stmt_close(stmt);
    767768
    768769    return rowsAffected;
    psS64 psDBUpdateRows(psDB *dbh, const ch  
    771772psS64 psDBDeleteRows(psDB *dbh, const char *tableName, psMetadata *where)
    772773{
    773774    char            *query;
     775    unsigned long   rowsAffected;
    774776
    775777    query = psDBGenerateDeleteRowSQL(tableName, where);
    776778    if (!query) {
    psS64 psDBDeleteRows(psDB *dbh, const ch  
    796798        return 1;
    797799    }
    798800
     801    // mysql_affected_rows() must be called before a commit
     802    rowsAffected = (psS64)mysql_affected_rows(dbh->mysql);
     803
    799804    // point of no return
    800805    mysql_commit(dbh->mysql);
    801806
    802     return (psS64)mysql_affected_rows(dbh->mysql);
     807    return rowsAffected;
    803808}
    804809
    805810// database utility functions