IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 26, 2018, 12:19:35 PM (8 years ago)
Author:
eugene
Message:

add -limit and -random to -definebyquery

File:
1 edited

Legend:

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

    r37410 r40534  
    279279    PXOPT_LOOKUP_STR(note, config->args, "-set_note", false, false);
    280280
     281    PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
     282
    281283    // default
    282284    PXOPT_LOOKUP_BOOL(unique, config->args, "-unique", false);
     
    284286    PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);
    285287   
     288    PXOPT_LOOKUP_BOOL(randomOrder, config->args, "-random", false);
     289
    286290    // find the exp_id of all the exposures that we want to queue up.
    287291    psString query = pxDataGet("chiptool_find_rawexp.sql");
     
    304308    }
    305309   
     310    // treat limit == 0 as "no limit"
     311    if (randomOrder) {
     312        psStringAppend(&query, " %s", "ORDER BY RAND()");
     313    }
     314
     315    // treat limit == 0 as "no limit"
     316    if (limit) {
     317        psString limitString = psDBGenerateLimitSQL(limit);
     318        psStringAppend(&query, " %s", limitString);
     319        psFree(limitString);
     320    }
     321
    306322    if (!p_psDBRunQueryF(config->dbh, query, labelHook ? labelHook : "")) {
    307323        psError(PS_ERR_UNKNOWN, false, "database error");
Note: See TracChangeset for help on using the changeset viewer.