IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 25, 2008, 9:12:41 AM (18 years ago)
Author:
eugene
Message:

adding include fields to flatcorrChipLink and flatcorrCamLink

File:
1 edited

Legend:

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

    r20377 r20397  
    3939static bool addchipMode(pxConfig *config);
    4040static bool addcameraMode(pxConfig *config);
     41static bool dropchipMode(pxConfig *config);
     42static bool dropcameraMode(pxConfig *config);
    4143static bool pendingprocessMode(pxConfig *config);
    4244static bool addprocessMode(pxConfig *config);
     
    6971        MODECASE(FLATCORR_MODE_ADDCHIP,        addchipMode);
    7072        MODECASE(FLATCORR_MODE_ADDCAMERA,      addcameraMode);
     73        MODECASE(FLATCORR_MODE_DROPCHIP,       dropchipMode);
     74        MODECASE(FLATCORR_MODE_DROPCAMERA,     dropcameraMode);
    7175        MODECASE(FLATCORR_MODE_PENDINGPROCESS, pendingprocessMode);
    7276        MODECASE(FLATCORR_MODE_ADDPROCESS,     addprocessMode);
     
    236240        }
    237241
    238         // add a flatcorrChipLink to the flatcorr Run we just created
    239         if (!flatcorrChipLinkInsert(config->dbh, corr_id, chip_id)) {
     242        // add a flatcorrChipLink to the flatcorr Run we just created (initial state has include = TRUE)
     243        if (!flatcorrChipLinkInsert(config->dbh, corr_id, chip_id, 1)) {
    240244            if (!psDBRollback(config->dbh)) {
    241245                psError(PS_ERR_UNKNOWN, false, "database error");
     
    337341    PXOPT_LOOKUP_S64(chip_id, config->args, "-chip_id", true, false);
    338342
    339     if (!flatcorrChipLinkInsert(config->dbh, corr_id, chip_id)) {
    340         psError(PS_ERR_UNKNOWN, false, "database error");
     343    // add a flatcorrChipLink (initial state has include = TRUE)
     344    if (!flatcorrChipLinkInsert(config->dbh, corr_id, chip_id, 1)) {
     345        psError(PS_ERR_UNKNOWN, false, "database error");
     346        return false;
     347    }
     348
     349    return true;
     350}
     351
     352static bool dropchipMode(pxConfig *config)
     353{
     354    PS_ASSERT_PTR_NON_NULL(config, false);
     355
     356    // required
     357    PXOPT_LOOKUP_S64(corr_id, config->args, "-corr_id", true, false);
     358    PXOPT_LOOKUP_S64(chip_id, config->args, "-chip_id", true, false);
     359
     360    // UPDATE flatcorrChipLink set include = 0 where corr_id = %lld AND chip_id = %lld
     361    psString query = pxDataGet("flatcorr_dropchip.sql");
     362    if (!query) {
     363        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     364        return false;
     365    }
     366
     367    if (!p_psDBRunQuery(config->dbh, query, (long long) corr_id, (long long) chip_id)) {
     368        psError(PS_ERR_UNKNOWN, false, "database error");
     369        psFree(query);
    341370        return false;
    342371    }
     
    448477        psS64 cam_id = psDBLastInsertID(config->dbh);
    449478
    450         // add the camRun entry to the flatcorrCamLink table:
    451         if (!flatcorrCamLinkInsert(config->dbh, corr_id, row->chip_id, cam_id)) {
     479        // add the camRun entry to the flatcorrCamLink table (include is TRUE)
     480        if (!flatcorrCamLinkInsert(config->dbh, corr_id, row->chip_id, cam_id, 1)) {
    452481            if (!psDBRollback(config->dbh)) {
    453482                psError(PS_ERR_UNKNOWN, false, "database error");
     
    467496
    468497    return false;
     498}
     499
     500static bool dropcameraMode(pxConfig *config)
     501{
     502    PS_ASSERT_PTR_NON_NULL(config, false);
     503
     504    // required
     505    PXOPT_LOOKUP_S64(corr_id, config->args, "-corr_id", true, false);
     506    PXOPT_LOOKUP_S64(cam_id, config->args, "-cam_id", true, false);
     507
     508    // UPDATE flatcorrCamLink set include = 0 where corr_id = %lld AND cam_id = %lld
     509    psString query = pxDataGet("flatcorr_dropcamera.sql");
     510    if (!query) {
     511        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     512        return false;
     513    }
     514
     515    if (!p_psDBRunQuery(config->dbh, query, (long long) corr_id, (long long) cam_id)) {
     516        psError(PS_ERR_UNKNOWN, false, "database error");
     517        psFree(query);
     518        return false;
     519    }
     520
     521    return true;
    469522}
    470523
Note: See TracChangeset for help on using the changeset viewer.