IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 1, 2007, 5:47:00 PM (19 years ago)
Author:
jhoblitt
Message:

add chipQueueRawExp() and remove dead code that it can be used in place of

File:
1 edited

Legend:

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

    r12174 r12177  
    2727#include "pxdata.h"
    2828#include "regtool.h"
     29#include "chiptool.h"
    2930
    3031static bool pendingimfileMode(pxConfig *config);
     
    4041
    4142// static guidePendingExpRow *newToP1PendingExp(newExpRow *newExp);
    42 static chipPendingExpRow *newTochipPendingExp(pxConfig *config, newExpRow *newExp);
    43 static chipPendingImfileRow *rawImfileTochipPendingImfile(pxConfig *config, psS64 chip_id, rawImfileRow *rawImfile);
     43//static chipPendingExpRow *newTochipPendingExp(pxConfig *config, newExpRow *newExp);
     44//static chipPendingImfileRow *rawImfileTochipPendingImfile(pxConfig *config, psS64 chip_id, rawImfileRow *rawImfile);
    4445
    4546static rawExpRow *newToRawExp(pxConfig *config, newExpRow *exp);
     
    636637        }
    637638
     639        psFree(newExp);
     640
    638641        // if this is a detrend image don't put it in the chip queue (and we're
    639642        // done)
    640643        if (detrend) {
    641             psFree(newExp);
    642644            continue;
    643645        }
    644646
    645647        // insert an entry into the chipPendingExp table
    646         chipPendingExpRow *chipPendingExp = newTochipPendingExp(config, newExp);
    647         if (!chipPendingExp) {
    648             psError(PS_ERR_UNKNOWN, false, "failed to convert newExp to chipPendingExp");
    649             psFree(newExp);
    650             psFree(output);
    651             return false;
    652         }
    653 
    654         // insert the chipPendingExp object into the database
    655         if (!chipPendingExpInsertObject(config->dbh, chipPendingExp)) {
     648        if (!chipQueueRawExp(config, exp_tag, NULL, NULL, NULL, NULL)) {
    656649            // rollback
    657650            if (!psDBRollback(config->dbh)) {
    658651                psError(PS_ERR_UNKNOWN, false, "database error");
    659652            }
    660             psError(PS_ERR_UNKNOWN, false, "database error");
    661             psFree(chipPendingExp);
    662             psFree(newExp);
     653            psError(PS_ERR_UNKNOWN, false, "failed to queue chipPendingExp");
    663654            psFree(output);
    664655            return false;
    665656        }
    666 
    667         // get the chip_id for the imfiles
    668         psS64 chip_id = psDBLastInsertID(config->dbh);
    669         psFree(chipPendingExp);
    670 
    671         // find all of the rawImfiles associated with the chipPendingExp object
    672         psArray *rawImfiles = NULL;
    673         {
    674             // build a query to search by exp_tag
    675             psMetadata *where = psMetadataAlloc();
    676             if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", newExp->exp_tag)) {
    677                 // rollback
    678                 if (!psDBRollback(config->dbh)) {
    679                     psError(PS_ERR_UNKNOWN, false, "database error");
    680                 }
    681                 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
    682                 psFree(where);
    683                 psFree(newExp);
    684                 psFree(output);
    685                 return false;
    686             }
    687             rawImfiles = rawImfileSelectRowObjects(config->dbh, where, 0);
    688             psFree(where);
    689         }
    690         // sanity check that least results were found
    691         if (!rawImfiles) {
    692             // rollback
    693             if (!psDBRollback(config->dbh)) {
    694                 psError(PS_ERR_UNKNOWN, false, "database error");
    695             }
    696             psError(PS_ERR_UNKNOWN, false, "database error");
    697             psFree(newExp);
    698             psFree(output);
    699             return false;
    700         }
    701         // sanity check the number of rawImfiles found
    702         if (psArrayLength(rawImfiles) != newExp->imfiles) {
    703             // rollback
    704             if (!psDBRollback(config->dbh)) {
    705                 psError(PS_ERR_UNKNOWN, false, "database error");
    706             }
    707             psError(PS_ERR_UNKNOWN, false, "found %ld rawImfiles but expected %d",
    708                     psArrayLength(rawImfiles), newExp->imfiles);
    709             psFree(newExp);
    710             psFree(output);
    711             return false;
    712         }
    713         // convert the rawImfiles into chipPendingImfiles and insert them into
    714         // the database
    715         for (long i = 0; i < psArrayLength(rawImfiles); i++) {
    716             rawImfileRow *rawImfile = rawImfiles->data[i];
    717             chipPendingImfileRow *pendingImfile = rawImfileTochipPendingImfile(config, chip_id, rawImfile);
    718             if (!chipPendingImfileInsertObject(config->dbh, pendingImfile)){
    719                 // rollback
    720                 if (!psDBRollback(config->dbh)) {
    721                     psError(PS_ERR_UNKNOWN, false, "database error");
    722                 }
    723                 psError(PS_ERR_UNKNOWN, false, "database error");
    724                 psFree(pendingImfile);
    725                 psFree(rawImfiles);
    726                 psFree(newExp);
    727                 psFree(output);
    728             }
    729             psFree(pendingImfile);
    730         }
    731         psFree(rawImfiles);
    732         psFree(newExp);
    733657    }
    734658
     
    879803
    880804
     805#if 0
    881806static chipPendingExpRow *newTochipPendingExp(pxConfig *config, newExpRow *exp)
    882807{
     
    914839    );
    915840}
     841#endif
    916842
    917843
Note: See TracChangeset for help on using the changeset viewer.