IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 10, 2007, 2:28:53 PM (19 years ago)
Author:
jhoblitt
Message:

change -register_detrend to print the detRun it just added

File:
1 edited

Legend:

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

    r12785 r12788  
    2626#include <stdlib.h>
    2727#include <stdint.h>
     28#include <inttypes.h>
    2829
    2930#include <ippdb.h>
     
    64056406    }
    64066407
     6408    // print the new detRun
     6409    psS64 det_id = psDBLastInsertID(config->dbh);
     6410    psArray *detRuns = NULL;
     6411    {
     6412        psMetadata *where = psMetadataAlloc();
     6413        psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==", det_id);
     6414        detRuns = psDBSelectRows(config->dbh, "detRun", where, 0);
     6415        psFree(where);
     6416    }
     6417    if (!detRuns) {
     6418        psError(PS_ERR_UNKNOWN, false, "can't find the detRun we just created");
     6419        return false;
     6420    }
     6421    // sanity check results
     6422    if (psArrayLength(detRuns) != 1) {
     6423        psAbort("found more then one detRun matching det_id %" PRId64 "(this should not happen)", det_id);
     6424        return false;
     6425    }
     6426
     6427    if (!convertIdToStr(detRuns)) {
     6428        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
     6429        psFree(detRuns);
     6430        return false;
     6431    }
     6432
     6433    bool simple = false;
     6434    {
     6435        bool status = false;
     6436        simple = psMetadataLookupBool(&status, config->args, "-simple");
     6437        if (!status) {
     6438            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
     6439            return false;
     6440        }
     6441    }
     6442
     6443    // negative simple so the default is true
     6444    if (!ippdbPrintMetadatas(stdout, detRuns, "detRun", !simple)) {
     6445        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     6446        psFree(detRuns);
     6447        return false;
     6448    }
     6449    psFree(detRuns);
     6450
    64076451    return true;
    64086452}
Note: See TracChangeset for help on using the changeset viewer.