IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 17, 2006, 1:32:28 PM (20 years ago)
Author:
jhoblitt
Message:

additional sanity checking

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/pzgetimfiles.c

    r10045 r10057  
    180180                }
    181181                psError(PS_ERR_UNKNOWN, false, "database error");
     182                return false;
     183            }
     184
     185            // sanity check: we should have removed only one row
     186            psU64 affected = psDBAffectedRows(config->dbh);
     187            if (psDBAffectedRows(config->dbh) != 1) {
     188                // rollback
     189                if (!psDBRollback(config->dbh)) {
     190                    psError(PS_ERR_UNKNOWN, false, "database error");
     191                }
     192                psError(PS_ERR_UNKNOWN, false, "should have affected 1 row but %" PRIu64 " rows were modified", affected);
    182193                return false;
    183194            }
     
    335346            return false;
    336347        }
     348
     349        // sanity check: we should have updated only one row
     350        psU64 affected = psDBAffectedRows(config->dbh);
     351        if (psDBAffectedRows(config->dbh) != 1) {
     352            // rollback
     353            if (!psDBRollback(config->dbh)) {
     354                psError(PS_ERR_UNKNOWN, false, "database error");
     355            }
     356            psError(PS_ERR_UNKNOWN, false, "should have affected 1 row but %" PRIu64 " rows were modified", affected);
     357            return false;
     358        }
    337359    }
    338360
     
    363385            return false;
    364386        }
     387
     388        // sanity check: we should have inserted only one row
     389        psU64 affected = psDBAffectedRows(config->dbh);
     390        if (psDBAffectedRows(config->dbh) != 1) {
     391            // rollback
     392            if (!psDBRollback(config->dbh)) {
     393                psError(PS_ERR_UNKNOWN, false, "database error");
     394            }
     395            psError(PS_ERR_UNKNOWN, false, "should have affected 1 row but %" PRIu64 " rows were modified", affected);
     396            return false;
     397        }
    365398    }
    366399 
     
    401434            return false;
    402435        }
     436 
     437        // sanity check: we should have removed only one row
     438        psU64 affected = psDBAffectedRows(config->dbh);
     439        if (psDBAffectedRows(config->dbh) != 1) {
     440            // rollback
     441            if (!psDBRollback(config->dbh)) {
     442                psError(PS_ERR_UNKNOWN, false, "database error");
     443            }
     444            psError(PS_ERR_UNKNOWN, false, "should have affected 1 row but %" PRIu64 " rows were modified", affected);
     445            return false;
     446        }
    403447    }
    404448
Note: See TracChangeset for help on using the changeset viewer.