IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 17, 2006, 3:08:57 PM (20 years ago)
Author:
jhoblitt
Message:

update pzDoneExp

File:
1 edited

Legend:

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

    r10057 r10063  
    417417        }
    418418    }
     419
     420    // cp the pzPendingExp entry to pzDoneExp
     421    {
     422        char *query =
     423            "INSERT INTO pzDoneExp"
     424            "   SELECT"
     425            "       pzPendingExp.*"
     426            "   FROM pzPendingExp"
     427            "   WHERE"
     428            "       pzPendingExp.exp_id = '%s'"
     429            "       AND pzPendingExp.camera = '%s'"
     430            "       AND pzPendingExp.telescope = '%s'";
     431        if (!p_psDBRunQuery(config->dbh, query, filesetid, camera, telescope)) {
     432            // rollback
     433            if (!psDBRollback(config->dbh)) {
     434                psError(PS_ERR_UNKNOWN, false, "database error");
     435            }
     436            psError(PS_ERR_UNKNOWN, false, "database error");
     437            return false;
     438        }
     439 
     440        // sanity check: we should have inserted only one row
     441        psU64 affected = psDBAffectedRows(config->dbh);
     442        if (psDBAffectedRows(config->dbh) != 1) {
     443            // rollback
     444            if (!psDBRollback(config->dbh)) {
     445                psError(PS_ERR_UNKNOWN, false, "database error");
     446            }
     447            psError(PS_ERR_UNKNOWN, false, "should have affected 1 row but %" PRIu64 " rows were modified", affected);
     448            return false;
     449        }
     450    }
    419451 
    420452    // remove the pzPendingExp entry for this exp (fileset)
Note: See TracChangeset for help on using the changeset viewer.