IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10035


Ignore:
Timestamp:
Nov 16, 2006, 6:24:38 PM (20 years ago)
Author:
jhoblitt
Message:

insert the pzPendingExp row into newExp to generated an exp_tag and update the pzPendingImfile entries with this tag.

File:
1 edited

Legend:

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

    r10024 r10035  
    184184        // point of no return
    185185        if (!psDBCommit(config->dbh)) {
     186            // rollback
     187            if (!psDBRollback(config->dbh)) {
     188                psError(PS_ERR_UNKNOWN, false, "database error");
     189            }
    186190            psError(PS_ERR_UNKNOWN, false, "database error");
    187191            return false;
     
    237241    psFree(newImfiles);
    238242
    239     // queue the imfiles (files) in pzPendingImfile
     243    // queue the imfiles (files) in pzPendingImfile -- must be done before the
     244    // imfile is insterted into summitImfile (after that happens when don't
     245    // know which imfiles are new anymore (well thats not exactly true but it
     246    // make be someday if we have to beable to resync to modified datastore
     247    // entries)
    240248    {
    241249        char *query =
     
    247255            "       incoming.class,"
    248256            "       incoming.class_id,"
    249             "       pzPendingExp.exp_tag"
     257            "       NULL" // exp_tag, will be assigned later
    250258            "   FROM incoming"
    251259            "   JOIN pzPendingExp"
     
    270278    }
    271279
    272     // move imfiles (files) from the temp table into summitImfiles
     280    // copy imfiles (files) from the temp table into summitImfiles
    273281    {
    274282        char *query =
     
    327335    }
    328336
     337    // copy the summitExp row into newExp in order to create a new exp_tag
     338    {
     339        char *query =
     340            "INSERT INTO newExp"
     341            "   SElECT"
     342            "       NULL," // exp_tag
     343            "       summitExp.exp_id,"
     344            "       summitExp.camera,"
     345            "       summitExp.telescope,"
     346            "       summitExp.dateobs,"
     347            "       summitExp.exp_type,"
     348            "       summitExp.imfiles"
     349            "   FROM summitExp"
     350            "   WHERE"
     351            "       summitExp.exp_id = '%s'"
     352            "       AND summitExp.camera = '%s'"
     353            "       AND summitExp.telescope = '%s'";
     354
     355        if (!p_psDBRunQuery(config->dbh, query)) {
     356            // rollback
     357            if (!psDBRollback(config->dbh)) {
     358                psError(PS_ERR_UNKNOWN, false, "database error");
     359            }
     360            psError(PS_ERR_UNKNOWN, false, "database error");
     361            return false;
     362        }
     363    }
     364 
     365    // set the exp_tag for the imfiles (files) in the exposure (fileset) that
     366    // we are investigating
     367    {
     368        char *query =
     369            "UPDATE pzPendingImfile"
     370            " SET exp_tag = LAST_INSERT_ID()"
     371            " WHERE"
     372            "   exp_id = '%s'"
     373            "   AND camera = '%s'"
     374            "   AND telescope = '%s'";
     375        if (!p_psDBRunQuery(config->dbh, query, filesetid, camera, telescope)) {
     376            // rollback
     377            if (!psDBRollback(config->dbh)) {
     378                psError(PS_ERR_UNKNOWN, false, "database error");
     379            }
     380            psError(PS_ERR_UNKNOWN, false, "database error");
     381            return false;
     382        }
     383    }
     384 
    329385    // remove the pzPendingExp entry for this exp (fileset)
    330386    {
     
    347403    // point of no return
    348404    if (!psDBCommit(config->dbh)) {
     405        // rollback
     406        if (!psDBRollback(config->dbh)) {
     407            psError(PS_ERR_UNKNOWN, false, "database error");
     408        }
    349409        psError(PS_ERR_UNKNOWN, false, "database error");
    350410        return false;
Note: See TracChangeset for help on using the changeset viewer.