IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 2, 2006, 12:26:31 PM (20 years ago)
Author:
jhoblitt
Message:

implement -processedexp

File:
1 edited

Legend:

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

    r9096 r9100  
    12931293{
    12941294    PS_ASSERT_PTR_NON_NULL(config, false);
     1295
     1296    psString query = psStringCopy("SELECT * FROM detProcessedExp");
     1297
     1298    if (config->where) {
     1299        psString whereClause = psDBGenerateWhereSQL(config->where, NULL);
     1300        psStringAppend(&query, " %s", whereClause);
     1301        psFree(whereClause);
     1302    }
     1303
     1304    if (!p_psDBRunQuery(config->dbh, query)) {
     1305        psError(PS_ERR_UNKNOWN, false, "database error");
     1306        psFree(query);
     1307        return false;
     1308    }
     1309    psFree(query);
     1310
     1311    psArray *output = p_psDBFetchResult(config->dbh);
     1312    if (!output) {
     1313        psError(PS_ERR_UNKNOWN, false, "database error");
     1314        return false;
     1315    }
     1316    if (!psArrayLength(output)) {
     1317        // XXX check psError here
     1318        psError(PS_ERR_UNKNOWN, false, "no detProcessedExp rows found");
     1319        psFree(output)
     1320        return true;
     1321    }
     1322
     1323    bool simple = false;
     1324    {
     1325        bool status = false;
     1326        simple = psMetadataLookupBool(&status, config->args, "-simple");
     1327        if (!status) {
     1328            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
     1329            return false;
     1330        }
     1331    }
     1332
     1333    // negative simple so the default is true
     1334    if (!ippdbPrintMetadatas(stdout, output, "detProcessedExp", !simple)) {
     1335        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     1336        psFree(output);
     1337        return false;
     1338    }
     1339
     1340    psFree(output);
    12951341
    12961342    return true;
Note: See TracChangeset for help on using the changeset viewer.