IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9146


Ignore:
Timestamp:
Oct 3, 2006, 12:01:12 PM (20 years ago)
Author:
jhoblitt
Message:

implement -normalizedexp

File:
1 edited

Legend:

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

    r9138 r9146  
    28222822    PS_ASSERT_PTR_NON_NULL(config, false);
    28232823
     2824    psString query = psStringCopy("SELECT * FROM detNormalizedExp");
     2825
     2826    if (config->where) {
     2827        psString whereClause = psDBGenerateWhereSQL(config->where, NULL);
     2828        psStringAppend(&query, " %s", whereClause);
     2829        psFree(whereClause);
     2830    }
     2831
     2832    if (!p_psDBRunQuery(config->dbh, query)) {
     2833        psError(PS_ERR_UNKNOWN, false, "database error");
     2834        psFree(query);
     2835        return false;
     2836    }
     2837    psFree(query);
     2838
     2839    psArray *output = p_psDBFetchResult(config->dbh);
     2840    if (!output) {
     2841        psError(PS_ERR_UNKNOWN, false, "database error");
     2842        return false;
     2843    }
     2844    if (!psArrayLength(output)) {
     2845        // XXX check psError here
     2846        psError(PS_ERR_UNKNOWN, false, "no detNormalizedExp rows found");
     2847        psFree(output)
     2848        return true;
     2849    }
     2850
     2851    bool simple = false;
     2852    {
     2853        bool status = false;
     2854        simple = psMetadataLookupBool(&status, config->args, "-simple");
     2855        if (!status) {
     2856            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
     2857            return false;
     2858        }
     2859    }
     2860
     2861    // negative simple so the default is true
     2862    if (!ippdbPrintMetadatas(stdout, output, "detNormalizedExp", !simple)) {
     2863        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     2864        psFree(output);
     2865        return false;
     2866    }
     2867
     2868    psFree(output);
     2869
    28242870    return true;
    28252871}
Note: See TracChangeset for help on using the changeset viewer.