IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10025


Ignore:
Timestamp:
Nov 16, 2006, 3:03:45 PM (20 years ago)
Author:
jhoblitt
Message:

rename -pending mode -> -pendingexp
add -pendingimfile mode

Location:
trunk/ippTools/src
Files:
3 edited

Legend:

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

    r9973 r10025  
    3030
    3131static bool seenMode(pxConfig *config);
    32 static bool pendingMode(pxConfig *config);
     32static bool pendingExpMode(pxConfig *config);
     33static bool pendingImfileMode(pxConfig *config);
    3334static bool copydoneMode(pxConfig *config);
    3435
    35 static psArray *pztoolPendingExp(pxConfig *config);
    36 static psArray *pztoolPendingImfiles(pxConfig *config);
    37 static bool pztoolFlushPendingExp(pxConfig *config);
     36//static psArray *pztoolPendingExp(pxConfig *config);
     37//static psArray *pztoolPendingImfiles(pxConfig *config);
     38//static bool pztoolFlushPendingExp(pxConfig *config);
    3839
    3940# define MODECASE(caseName, func) \
     
    5354    switch (config->mode) {
    5455        MODECASE(PZTOOL_MODE_SEEN, seenMode);
    55         MODECASE(PZTOOL_MODE_PENDING, pendingMode);
     56        MODECASE(PZTOOL_MODE_PENDINGEXP, pendingExpMode);
     57        MODECASE(PZTOOL_MODE_PENDINGIMFILE, pendingImfileMode);
    5658        MODECASE(PZTOOL_MODE_COPYDONE, copydoneMode);
    5759        default:
     
    6264    pmConfigDone();
    6365    psLibFinalize();
    64 
    6566
    6667    exit(EXIT_SUCCESS);
     
    7879    PS_ASSERT_PTR_NON_NULL(config, false);
    7980
    80     psString query = psStringCopy(
    81         "SELECT"
    82         "    summitExp.*"
    83         " FROM summitExp"
    84         " LEFT JOIN newExp"
    85         "   USING(exp_id, camera, telescope)"
    86         " WHERE"
    87         "   newExp.exp_id is NULL"
    88         "   AND newExp.camera IS NULL"
    89         "   AND newExp.telescope IS NULL"
    90     );
     81    psString query = psStringCopy("SELECT * FROM summitExp");
    9182
    9283    if (config->where) {
     
    109100    }
    110101    if (!psArrayLength(output)) {
    111         psError(PS_ERR_UNKNOWN, false, "no newExp rows found");
     102        psError(PS_ERR_UNKNOWN, false, "no rows found");
    112103        psFree(output);
    113104        return true;
     
    125116
    126117    // negative simple so the default is true
    127     if (!ippdbPrintMetadatas(stdout, output, "newExp", !simple)) {
     118    if (!ippdbPrintMetadatas(stdout, output, "summitExp", !simple)) {
    128119        psError(PS_ERR_UNKNOWN, false, "failed to print array");
    129120        psFree(output);
     
    136127}
    137128
    138 static bool pendingMode(pxConfig *config)
     129static bool pendingExpMode(pxConfig *config)
    139130{
    140131    PS_ASSERT_PTR_NON_NULL(config, false);
    141132
    142     psArray *pending = pzPendingFrameSearch(config);
    143     if (!pending) {
    144         psError(PS_ERR_UNKNOWN, false, "no pzPendingFrames found");
    145         return false;
    146     }
    147     if (!pzPendingFramePrint(stdout, config, pending)) {
    148         psError(PS_ERR_UNKNOWN, false, "pzPendingFramePrint() failed");
    149         return false;
    150     }
     133    psString query = psStringCopy(
     134            "SELECT"
     135            "   summitExp.*"
     136            " FROM pzPendingExp"
     137            " JOIN summitExp"
     138            "   USING(exp_id, camera, telescope)"
     139        );
     140
     141    if (config->where) {
     142        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "pzPendingExp");
     143        psStringAppend(&query, " AND %s", whereClause);
     144        psFree(whereClause);
     145    }
     146
     147    if (!p_psDBRunQuery(config->dbh, query)) {
     148        psError(PS_ERR_UNKNOWN, false, "database error");
     149        psFree(query);
     150        return false;
     151    }
     152    psFree(query);
     153
     154    psArray *output = p_psDBFetchResult(config->dbh);
     155    if (!output) {
     156        psError(PS_ERR_UNKNOWN, false, "database error");
     157        return false;
     158    }
     159    if (!psArrayLength(output)) {
     160        psError(PS_ERR_UNKNOWN, false, "no rows found");
     161        psFree(output);
     162        return true;
     163    }
     164
     165    bool simple = false;
     166    {
     167        bool status = false;
     168        simple = psMetadataLookupBool(&status, config->args, "-simple");
     169        if (!status) {
     170            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
     171            psFree(output);
     172            return false;
     173        }
     174    }
     175
     176    // negative simple so the default is true
     177    if (!ippdbPrintMetadatas(stdout, output, "summitExp", !simple)) {
     178        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     179        psFree(output);
     180        return false;
     181    }
     182
     183    psFree(output);
    151184
    152185    return true;
    153186}
    154187
     188static bool pendingImfileMode(pxConfig *config)
     189{
     190    PS_ASSERT_PTR_NON_NULL(config, false);
     191
     192    psString query = psStringCopy(
     193            "SELECT"
     194            "   summitImfile.*"
     195            " FROM pzPendingImfile"
     196            " JOIN summitImfile"
     197            "   USING(exp_id, camera, telescope, class, class_id)"
     198        );
     199
     200    if (config->where) {
     201        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "pzPendingImfile");
     202        psStringAppend(&query, " AND %s", whereClause);
     203        psFree(whereClause);
     204    }
     205
     206    if (!p_psDBRunQuery(config->dbh, query)) {
     207        psError(PS_ERR_UNKNOWN, false, "database error");
     208        psFree(query);
     209        return false;
     210    }
     211    psFree(query);
     212
     213    psArray *output = p_psDBFetchResult(config->dbh);
     214    if (!output) {
     215        psError(PS_ERR_UNKNOWN, false, "database error");
     216        return false;
     217    }
     218    if (!psArrayLength(output)) {
     219        psError(PS_ERR_UNKNOWN, false, "no rows found");
     220        psFree(output);
     221        return true;
     222    }
     223
     224    bool simple = false;
     225    {
     226        bool status = false;
     227        simple = psMetadataLookupBool(&status, config->args, "-simple");
     228        if (!status) {
     229            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
     230            psFree(output);
     231            return false;
     232        }
     233    }
     234
     235    // negative simple so the default is true
     236    if (!ippdbPrintMetadatas(stdout, output, "summitImfile", !simple)) {
     237        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     238        psFree(output);
     239        return false;
     240    }
     241
     242    psFree(output);
     243
     244    return true;
     245}
     246
    155247static bool copydoneMode(pxConfig *config)
    156248{
    157249    PS_ASSERT_PTR_NON_NULL(config, false);
    158250
     251#if 0
    159252    // we don't have to operate on complete frames here as it's ok to start
    160253    // downloading the imfiles before the exp has been registered
     
    178271        if (!newImfileInsert(
    179272            config->dbh,
    180             pendingImfile->exp_id,
     273            pendingImfile->exp_tag,
    181274            pendingImfile->class,
    182             pendingImfile->class_id,
     275            pendingImfile->class_id
     276            )
    183277            // XXX get this from the CLI
    184             pendingImfile->uri)
     278//            pendingImfile->uri
    185279        ) {
    186280            psError(PS_ERR_UNKNOWN, false, "dbh access failed");
     
    217311        psError(PS_ERR_UNKNOWN, false, "database error");
    218312    }
     313#endif
    219314
    220315    return false;
    221316}
    222317
     318#if 0
    223319static psArray *pztoolPendingExp(pxConfig *config)
    224320{
     
    302398    return true;
    303399}
     400
     401#endif
  • trunk/ippTools/src/pztool.h

    r9392 r10025  
    2626    PZTOOL_MODE_NONE      = 0x0,
    2727    PZTOOL_MODE_SEEN,
    28     PZTOOL_MODE_PENDING,
     28    PZTOOL_MODE_PENDINGEXP,
     29    PZTOOL_MODE_PENDINGIMFILE,
    2930    PZTOOL_MODE_COPYDONE
    3031} pztoolMode;
  • trunk/ippTools/src/pztoolConfig.c

    r9973 r10025  
    5353            "use the simple output format", false);
    5454   
    55     // -pending
    56     psMetadata *pendingArgs = psMetadataAlloc();
    57     psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_tag", 0,
    58             "define exposure ID", NULL);
    59     psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-inst", 0,
     55    // -pendingexp
     56    psMetadata *pendingexpArgs = psMetadataAlloc();
     57    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_tag", 0,
     58            "define exposure ID", NULL);
     59    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-inst", 0,
    6060            "define camera ID", NULL);
    61     psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-telescope", 0,
     61    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-telescope", 0,
    6262            "define telescope ID", NULL);
    63     psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_type", 0,
     63    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_type", 0,
    6464            "define exposure type", NULL);
     65    psMetadataAddBool(pendingexpArgs, PS_LIST_TAIL, "-simple", 0,
     66            "use the simple output format", false);
     67
     68    // -pendingimfile
     69    psMetadata *pendingimfileArgs = psMetadataAlloc();
     70    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_tag", 0,
     71            "define exposure ID", NULL);
     72    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-inst", 0,
     73            "define camera ID", NULL);
     74    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-telescope", 0,
     75            "define telescope ID", NULL);
     76    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_type", 0,
     77            "define exposure type", NULL);
     78    psMetadataAddBool(pendingimfileArgs, PS_LIST_TAIL, "-simple", 0,
     79            "use the simple output format", false);
    6580
    6681    // -copydone
     
    96111    // find which mode we're running under
    97112    PXTOOL_MODE("-seen",            PZTOOL_MODE_SEEN,         seenArgs);
    98     PXTOOL_MODE("-pending",         PZTOOL_MODE_PENDING,      pendingArgs);
     113    PXTOOL_MODE("-pendingexp",      PZTOOL_MODE_PENDINGEXP,   pendingexpArgs);
     114    PXTOOL_MODE("-pendingimfile",   PZTOOL_MODE_PENDINGIMFILE,pendingimfileArgs);
    99115    PXTOOL_MODE("-copydone",        PZTOOL_MODE_COPYDONE,     copydoneArgs);
    100116
Note: See TracChangeset for help on using the changeset viewer.