IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15695 for trunk/ippTools/src


Ignore:
Timestamp:
Nov 26, 2007, 4:49:32 PM (18 years ago)
Author:
jhoblitt
Message:

mostly impliement flatcorr -pending

File:
1 edited

Legend:

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

    r15684 r15695  
    337337    PS_ASSERT_PTR_NON_NULL(config, false);
    338338
     339    // create a temp table to hold completely processed chipRuns
     340{
     341    psString query = pxDataGet("flatcorr_create_tmp_chiprundone.sql");
     342    if (!query) {
     343        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     344        return false;
     345    }
     346
     347    if (!p_psDBRunQuery(config->dbh, query)) {
     348        psError(PS_ERR_UNKNOWN, false, "database error");
     349        psFree(query);
     350        return false;
     351    }
     352
     353    psFree(query);
     354}
     355
     356   
     357    // find all completed chipRuns
     358{
     359    psString query = pxDataGet("flatcorr_completely_processed_chiprun.sql");
     360    if (!query) {
     361        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     362        return false;
     363    }
     364
     365    if (!p_psDBRunQuery(config->dbh, query)) {
     366        psError(PS_ERR_UNKNOWN, false, "database error");
     367        psFree(query);
     368        return false;
     369    }
     370
     371    psFree(query);
     372}
     373    // find flatcorrRun's that have had all of their chipRun's completed by
     374    // comparing against the temp table
     375    psString query = pxDataGet("flatcorr_find_completed_floatcorruns.sql");
     376    if (!query) {
     377        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     378        return false;
     379    }
     380
     381    if (!p_psDBRunQuery(config->dbh, query)) {
     382        psError(PS_ERR_UNKNOWN, false, "database error");
     383        psFree(query);
     384        return false;
     385    }
     386
     387    psArray *output = p_psDBFetchResult(config->dbh);
     388    if (!output) {
     389        psErrorCode err = psErrorCodeLast();
     390        switch (err) {
     391            case PS_ERR_DB_CLIENT:
     392                psError(PXTOOLS_ERR_SYS, false, "database error");
     393            case PS_ERR_DB_SERVER:
     394                psError(PXTOOLS_ERR_PROG, false, "database error");
     395            default:
     396                psError(PXTOOLS_ERR_PROG, false, "unknown error");
     397        }
     398
     399        return false;
     400    }
     401    if (!psArrayLength(output)) {
     402        psTrace("regtool", PS_LOG_INFO, "no rows found");
     403        psFree(output);
     404        return true;
     405    }
     406
     407    bool simple = false;
     408    {
     409        bool status = false;
     410        simple = psMetadataLookupBool(&status, config->args, "-simple");
     411        if (!status) {
     412            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
     413            return false;
     414        }
     415    }
     416
     417    if (psArrayLength(output)) {
     418        // negative simple so the default is true
     419        if (!ippdbPrintMetadatas(stdout, output, "flatcorrPending", !simple)) {
     420            psError(PS_ERR_UNKNOWN, false, "failed to print array");
     421            psFree(output);
     422            return false;
     423        }
     424    }
     425
     426    psFree(output);
     427
    339428    return false;
    340429}
Note: See TracChangeset for help on using the changeset viewer.