IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 25, 2011, 2:59:55 PM (15 years ago)
Author:
heather
Message:

merging in addstar changes to the trunk

Location:
trunk/ippTools/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src

  • trunk/ippTools/src/pxadd.c

    r28181 r31375  
    3737    if (!pxIsValidState(state)) {
    3838        psError(PS_ERR_UNKNOWN, false,
    39                 "invalid camRun state: %s", state);
     39                "invalid stageRun state: %s", state);
    4040        return false;
    4141    }
     
    5151
    5252
    53 bool pxaddRunSetStateByQuery(pxConfig *config, psMetadata *where, const char *state)
     53bool pxaddRunSetStateByQuery(pxConfig *config, psMetadata *where, const char *stage, const char *state)
    5454{
    5555    PS_ASSERT_PTR_NON_NULL(config, false);
     
    5959    if (!pxIsValidState(state)) {
    6060        psError(PS_ERR_UNKNOWN, false,
    61                 "invalid chipRun state: %s", state);
     61                "invalid stageRun state: %s", state);
    6262        return false;
    6363    }
    64 
    65     psString query = psStringCopy("UPDATE addRun JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) SET addRun.state = '%s'");
    66 
     64    psString query = NULL;
     65    if (strcmp(stage, "cam") == 0) {
     66      query = psStringCopy("UPDATE addRun JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) SET addRun.state = '%s'");
     67    }
     68    if (strcmp(stage, "stack") == 0) {
     69      ///xxx this needs to be fixed
     70     
     71      /// psString query = psStringCopy("UPDATE addRun JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) SET addRun.state = '%s'");
     72    }
    6773    if (where) {
    6874        psString whereClause = psDBGenerateWhereSQL(where, NULL);
     
    98104}
    99105
    100 bool pxaddRunSetLabelByQuery(pxConfig *config, psMetadata *where, const char *label)
     106bool pxaddRunSetLabelByQuery(pxConfig *config, psMetadata *where, const char *stage, const char *label)
    101107{
    102108    PS_ASSERT_PTR_NON_NULL(config, false);
    103109    // note label == NULL should be explicitly allowed
    104 
     110    //xxx fix for stack
    105111    psString query = psStringCopy("UPDATE addRun JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) SET addRun.label = '%s'");
    106112
     
    123129
    124130bool pxaddQueueByCamID(pxConfig *config,
    125                        psS64 cam_id,
     131                       char *stage,
     132                       psS64 stage_id,
    126133                       char *workdir,
    127134                       char *reduction,
     
    140147    static psString query = NULL;
    141148    if (!query) {
     149      if (strcmp( stage , "cam") == 0) {
    142150        query = pxDataGet("addtool_queue_cam_id.sql");
    143151        psMemSetPersistent(query, true);
     152      }
     153      if (strcmp(stage,"stack") == 0) {
     154        query = pxDataGet("addtool_queue_stack_id.sql");
     155        psMemSetPersistent(query, true);
     156      }
     157      if (strcmp(stage,"staticsky") == 0) {
     158        query = pxDataGet("addtool_queue_sky_id.sql");
     159        psMemSetPersistent(query, true);
     160      }
    144161        if (!query) {
    145162            psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     
    148165    }
    149166
     167    psTrace("addtool.c", PS_LOG_INFO, "pxadd query \n%s\n",query);
    150168    // queue the exp
    151169    // Note: cam_id is being cast here work around psS64 have a different type different
    152170    // on 32/64
    153171    if (!p_psDBRunQueryF(config->dbh, query,
    154                         "new", // state
     172                        "new", // state
    155173                         workdir  ? workdir   : "NULL",
    156                          "dirty", //workdir_state
     174                          "dirty", //workdir_state
    157175                         reduction? reduction : "NULL",
    158176                         label    ? label     : "NULL",
     
    164182                         minidvodb_group,
    165183                         minidvodb_name,
    166                          (long long) cam_id
     184                         (long long) stage_id
    167185    )) {
    168186      psError(PS_ERR_UNKNOWN, false, "database error %s", query);
Note: See TracChangeset for help on using the changeset viewer.