IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 5, 2007, 10:15:41 AM (19 years ago)
Author:
jhoblitt
Message:

merge backtrack branch

File:
1 edited

Legend:

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

    r11854 r14018  
    2424#include <stdlib.h>
    2525#include <ippdb.h>
     26#include <string.h>
    2627
    2728#include "pxtools.h"
    28 #include "pxtag.h"
    2929#include "pxinject.h"
    3030
    3131static bool newExpMode(pxConfig *config);
    3232static bool newImfileMode(pxConfig *config);
     33static bool updatenewExpMode(pxConfig *config);
    3334
    3435# define MODECASE(caseName, func) \
     
    5253        MODECASE(PXINJECT_MODE_NEWEXP, newExpMode);
    5354        MODECASE(PXINJECT_MODE_NEWIMFILE, newImfileMode);
     55        MODECASE(PXINJECT_MODE_UPDATENEWEXP, updatenewExpMode);
    5456        default:
    5557            psAbort("invalid option (this should not happen)");
     
    134136                exp_tag,
    135137                exp_id,
     138                "reg", // state
    136139                camera,
    137140                telescope,
    138141                imfiles,
    139                 workdir
     142                workdir,
     143                "dirty"
    140144            )
    141145        ) {
     
    191195        return false;
    192196    }
     197#if 0
    193198    psString class = psMetadataLookupStr(&status, config->args, "-class");
    194199    if (!status) {
     
    200205        return false;
    201206    }
     207#endif
    202208    psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");
    203209    if (!status) {
     
    220226
    221227    // insert with error flag state set to 0 (no errors)
    222     if (!newImfileInsert(config->dbh, exp_tag, class, class_id, uri)) {
     228    if (!newImfileInsert(config->dbh, exp_tag, class_id, uri)) {
    223229        psError(PS_ERR_UNKNOWN, false, "database error");
    224230        return false;
     
    227233    return true;
    228234}
     235
     236
     237static bool updatenewExpMode(pxConfig *config)
     238{
     239    PS_ASSERT_PTR_NON_NULL(config, false);
     240
     241    bool status = false;
     242    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
     243    if (!status) {
     244        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
     245        return false;
     246    }
     247    if (!exp_tag) {
     248        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
     249        return false;
     250    }
     251
     252    psString state = psMetadataLookupStr(&status, config->args, "-state");
     253    if (!status) {
     254        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -state");
     255        return false;
     256    }
     257    if (!state) {
     258        psError(PS_ERR_UNKNOWN, true, "-state is required");
     259        return false;
     260    }
     261
     262    if (state) {
     263        // set detRun.state to state
     264        return pxnewExpSetState(config, exp_tag, state);
     265    }
     266
     267    return true;
     268}
Note: See TracChangeset for help on using the changeset viewer.