IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 10, 2010, 6:28:51 PM (16 years ago)
Author:
watersc1
Message:

Skycell Summary and stack Association stuff should be finished. I'll merge and do final tests on monday.

Location:
branches/czw_branch/20100519
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20100519

  • branches/czw_branch/20100519/ippTools/src

    • Property svn:ignore
      •  

        old new  
        3838stamp-h1
        3939warptool
        40 
         40staticskytool
  • branches/czw_branch/20100519/ippTools/src/pstamptool.c

    r27969 r28304  
    3030#include "pxdata.h"
    3131#include "pstamptool.h"
     32#include "pstamp.h"
    3233
    3334static bool adddatastoreMode(pxConfig *config);
     
    5354static bool updatedependentMode(pxConfig *config);
    5455static bool revertdependentMode(pxConfig *config);
     56static bool getwebrequestnumMode(pxConfig *config);
    5557
    5658# define MODECASE(caseName, func) \
     
    9597        MODECASE(PSTAMPTOOL_MODE_UPDATEDEPENDENT, updatedependentMode);
    9698        MODECASE(PSTAMPTOOL_MODE_REVERTDEPENDENT, revertdependentMode);
     99        MODECASE(PSTAMPTOOL_MODE_GETWEBREQUESTNUM, getwebrequestnumMode);
    97100        default:
    98101            psAbort("invalid option (this should not happen)");
     
    939942    PXOPT_LOOKUP_S16(fault, config->args, "-fault",  false, false);
    940943
    941     // By default only revert faults < 10 which are our "ipp exit codes"
     944    // By default only revert faults < PSTAMP_FIRST_ERROR_CODE which are our "ipp exit codes"
    942945    // codes larger than that are the pstamp request interface.
    943946    // Don't fault those unless -fault waa provided
    944     psString faultClause = "";
     947    psString faultClause = psStringCopy("");
    945948    if (!fault) {
    946         faultClause = " \nAND (pstampJob.fault < 10)";
     949        psStringAppend(&faultClause, " \nAND (pstampJob.fault < %d)", PSTAMP_FIRST_ERROR_CODE);
    947950    }
    948951
     
    961964
    962965    if (!p_psDBRunQueryF(config->dbh, query, faultClause)) {
    963         psError(PS_ERR_UNKNOWN, false, "database error");
    964         return false;
    965     }
     966        psFree(faultClause);
     967        psFree(query);
     968        psError(PS_ERR_UNKNOWN, false, "database error");
     969        return false;
     970    }
     971
     972    psFree(faultClause);
    966973
    967974    return true;
     
    11331140            psFree(output);
    11341141            return false;
     1142        }
     1143        psS32 fault = psMetadataLookupS64(NULL, dep, "fault");
     1144        if (fault > 0) {
     1145            fprintf(stderr, "existing dependent has fault %d\n", fault);
     1146            exit (fault);
    11351147        }
    11361148        printf("%" PRId64 "\n", dep_id);
     
    13151327        return false;
    13161328    }
     1329
     1330    PXOPT_LOOKUP_S16(fault,      config->args, "-fault",          false, false);
     1331
    13171332    psString query = pxDataGet("pstamptool_revertdependent.sql");
    13181333    if (!query) {
     
    13261341    psFree(where);
    13271342
    1328     if (!p_psDBRunQuery(config->dbh, query)) {
    1329         psError(PS_ERR_UNKNOWN, false, "database error");
    1330         psFree(query);
    1331         return false;
    1332     }
    1333 
    1334     return true;
    1335 }
     1343    if (!fault) {
     1344        // unless asked to clear a specific fault value, restrict reverts to fault codes
     1345        // that are less than the minimum fault in the API
     1346        psStringAppend(&query, " AND (pstampDependent.fault < %d)", PSTAMP_FIRST_ERROR_CODE);
     1347    }
     1348
     1349    if (!p_psDBRunQuery(config->dbh, query)) {
     1350        psError(PS_ERR_UNKNOWN, false, "database error");
     1351        psFree(query);
     1352        return false;
     1353    }
     1354
     1355    return true;
     1356}
     1357
     1358static bool getwebrequestnumMode(pxConfig *config)
     1359{
     1360    PS_ASSERT_PTR_NON_NULL(config, false);
     1361
     1362    if (!pstampWebRequestInsert(config->dbh, 0 )) {
     1363        psError(PS_ERR_UNKNOWN, false, "failed to insert pstampWebRequest");
     1364        return false;
     1365    }
     1366
     1367    psS64 req_id = psDBLastInsertID(config->dbh);
     1368
     1369    printf("%" PRId64 "\n", req_id);
     1370
     1371    return true;
     1372}
Note: See TracChangeset for help on using the changeset viewer.