IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 25, 2007, 10:19:18 AM (19 years ago)
Author:
jhoblitt
Message:

overhaul new* -> raw* table transistions to keep the complete history

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/backtrack/ippTools/src/regtool.c

    r13617 r13967  
    282282                return false;
    283283            }
     284            psFree(object);
    284285            // insert the rawImfile object into the database
    285286            if (!rawImfileInsertObject(config->dbh, imfile)) {
     
    290291                psError(PS_ERR_UNKNOWN, false, "failed to insert row into the database");
    291292                psFree(imfile);
    292                 psFree(object);
    293293                psFree(output);
    294294                return false;
    295295            }
    296296            psFree(imfile);
    297             // remove the neImfile object from the database
    298             if (!newImfileDeleteObject(config->dbh, object)) {
    299                 // rollback
    300                 if (!psDBRollback(config->dbh)) {
    301                     psError(PS_ERR_UNKNOWN, false, "database error");
    302                 }
    303                 psError(PS_ERR_UNKNOWN, false, "failed to delete row from the database");
    304                 psFree(object);
    305                 psFree(output);
    306                 return false;
    307             }
    308             psFree(object);
    309297        }
    310298
     
    573561    }
    574562    if (!psArrayLength(output)) {
    575         psTrace("regtool", PS_LOG_INFO, "no rows found");
     563        psError(PS_ERR_UNKNOWN, false, "no pending newExp rows found");
    576564        psFree(output);
    577         return true;
    578     }
    579 
    580     // start a transaction so we don't end up with an exp in both rawExp &
    581     // newExp
     565        return false;
     566    }
     567
    582568    if (!psDBTransaction(config->dbh)) {
    583569        psError(PS_ERR_UNKNOWN, false, "database error");
     
    603589            return false;
    604590        }
     591        psFree(newExp);
    605592
    606593        // insert the rawExp object into the database
     
    612599            psError(PS_ERR_UNKNOWN, false, "database error");
    613600            psFree(rawExp);
    614             psFree(newExp);
    615601            psFree(output);
    616602            return false;
    617603        }
    618604        psFree(rawExp);
    619 
    620         // delete the newExp object from the database
    621         if (!newExpDeleteObject(config->dbh, newExp)) {
    622             // rollback
    623             if (!psDBRollback(config->dbh)) {
    624                 psError(PS_ERR_UNKNOWN, false, "database error");
    625             }
    626             psError(PS_ERR_UNKNOWN, false, "database error");
    627             psFree(newExp);
    628             psFree(output);
    629             return false;
    630         }
    631 
    632         psFree(newExp);
    633605
    634606        // if this is a detrend image don't put it in the chip queue (and we're
    635607        // done)
    636608        if (detrend) {
     609            // set the state for the newExp to stop
     610            if (!pxnewExpSetState(config, exp_tag, "stop")) {
     611                // rollback
     612                if (!psDBRollback(config->dbh)) {
     613                    psError(PS_ERR_UNKNOWN, false, "database error");
     614                }
     615                psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_tag: %s", exp_tag);
     616                psFree(output);
     617                return false;
     618            }
    637619            continue;
    638620        }
     
    648630            return false;
    649631        }
    650     }
    651 
     632
     633        // set the state for the newExp to stop
     634        if (!pxnewExpSetState(config, exp_tag, "stop")) {
     635            // rollback
     636            if (!psDBRollback(config->dbh)) {
     637                psError(PS_ERR_UNKNOWN, false, "database error");
     638            }
     639            psError(PS_ERR_UNKNOWN, false, "failed to change newExp.state for exp_tag: %s", exp_tag);
     640            psFree(output);
     641            return false;
     642        }
     643    }
    652644    psFree(output);
    653645
Note: See TracChangeset for help on using the changeset viewer.