IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28320


Ignore:
Timestamp:
Jun 14, 2010, 5:11:02 PM (16 years ago)
Author:
Paul Price
Message:

Add pretend option to pubtool -definerun.

Location:
trunk/ippTools/src
Files:
2 edited

Legend:

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

    r28319 r28320  
    165165
    166166    PXOPT_LOOKUP_BOOL(rerun, config->args, "-rerun", false);
     167    PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false);
     168    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     169    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    167170
    168171    psString query = pxDataGet("pubtool_definerun.sql"); // Query to run
     
    174177
    175178    if (!rerun) {
    176         psStringAppend(&query, "WHERE publishRun.client_id IS NULL");
     179        psStringAppend(&query, "\nWHERE publishRun.client_id IS NULL");
     180    }
     181
     182    if (limit) {
     183        psString limitString = psDBGenerateLimitSQL(limit);
     184        psStringAppend(&query, "\n%s", limitString);
     185        psFree(limitString);
    177186    }
    178187
     
    213222    if (!psArrayLength(output)) {
    214223        psTrace("pubtool", PS_LOG_INFO, "No rows found");
     224        psFree(output);
     225        return true;
     226    }
     227
     228    if (pretend) {
     229        if (!ippdbPrintMetadatas(stdout, output, "publishRun", !simple)) {
     230            psError(psErrorCodeLast(), false, "Failed to print array");
     231            psFree(output);
     232            return false;
     233        }
    215234        psFree(output);
    216235        return true;
  • trunk/ippTools/src/pubtoolConfig.c

    r28319 r28320  
    6565    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "set and search by label", NULL);
    6666    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by data_group", NULL);
    67     psMetadataAddBool(definerunArgs, PS_LIST_TAIL, "-rerun", 0, "Re-run publish?", false);
    6867    psMetadataAddTime(definerunArgs, PS_LIST_TAIL, "-dateobs_begin", 0, "search for exposures by time (>=)", NULL);
    6968    psMetadataAddTime(definerunArgs, PS_LIST_TAIL, "-dateobs_end", 0, "search for exposures by time (<=)", NULL);
    7069    psMetadataAddStr(definerunArgs,  PS_LIST_TAIL, "-filter", 0, "search for filter", NULL);
    7170    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-obs_mode", 0, "search by observation mode", NULL);
    72 
     71    psMetadataAddBool(definerunArgs, PS_LIST_TAIL, "-rerun", 0, "Re-run publish?", false);
     72    psMetadataAddBool(definerunArgs, PS_LIST_TAIL, "-pretend", 0, "Pretend to define?", false);
     73    psMetadataAddBool(definerunArgs, PS_LIST_TAIL, "-simple",  0, "use simple output format?", false);
     74    psMetadataAddU64(definerunArgs, PS_LIST_TAIL, "-limit",  0, "limit result set", 0);
    7375
    7476    // -pending
Note: See TracChangeset for help on using the changeset viewer.