IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 11, 2006, 6:11:56 PM (20 years ago)
Author:
jhoblitt
Message:

update -raw to include det_id & det_type in the output

File:
1 edited

Legend:

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

    r8293 r8307  
    748748    PS_ASSERT_PTR_NON_NULL(config, false);
    749749
    750     // search from rawImfiles
    751     psArray *rawImfiles = searchRawImfiles(config, NULL);
    752     if (!rawImfiles) {
    753         psError(PS_ERR_UNKNOWN, false, "no rawImfile rows found");
    754         return false;
    755     }
    756 
    757     // remove detProcessedImfiles
    758     psArray *processedImfiles = detProcessedImfileSelectRowObjects(
    759         config->dbh, config->where, 0);
    760     // XXX trace the not found case
    761     if (processedImfiles) {
    762         for (long i = 0; i < psArrayLength(rawImfiles); i++) {
    763             for (long j = 0; j < psArrayLength(processedImfiles); j++) {
    764                 if ((strcmp(
    765                 ((rawImfileRow *)rawImfiles->data[i])->exp_id,
    766                 ((detProcessedImfileRow *)processedImfiles->data[j])->exp_id)
    767                 == 0) && (strcmp(
    768                 ((rawImfileRow *)rawImfiles->data[i])->class_id,
    769                 ((detProcessedImfileRow *)processedImfiles->data[j])->class_id)
    770                 == 0)) {
    771                     // remove the rawImfiles from the list
    772                     psArrayRemove(rawImfiles, rawImfiles->data[i]);
    773                     i--;
    774                     break;
    775                 }
    776             }
    777         }
    778         psFree(processedImfiles);
     750    psString query = psStringCopy(
     751            "SELECT detInputExp.det_id, detRun.det_type, rawImfile.*"
     752            " FROM rawImfile JOIN detInputExp USING(exp_id) "
     753            " JOIN detRun ON detInputExp.det_id = detRun.position");
     754
     755    // XXX search criterian are disabled
     756#if 0
     757    if (config->where) {
     758        psString whereClaus = psDBGenerateWhereConditionSQL(config->where);
     759        psStringAppend(&query, " AND %s", whereClaus);
     760        psFree(whereClaus);
     761    }
     762#endif
     763
     764    if (!p_psDBRunQuery(config->dbh, query)) {
     765        psError(PS_ERR_UNKNOWN, false, "database error");
     766        psFree(query);
     767        return false;
     768    }
     769    psFree(query);
     770
     771    psArray *output = p_psDBFetchResult(config->dbh);
     772    if (!output) {
     773        // XXX check psError here
     774        psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
     775        return false;
    779776    }
    780777
     
    789786    }
    790787
    791     // did we remove all of the rawImfiles?
    792     if (rawImfiles->n) {
    793         // negative simple so the default is true
    794         if (!rawImfilePrintObjects(stdout, rawImfiles, !simple)) {
    795             psError(PS_ERR_UNKNOWN, false, "failed to print array");
    796             psFree(rawImfiles);
    797             return false;
    798         }
    799     }
    800 
    801     psFree(rawImfiles);
     788    // negative simple so the default is true
     789    if (!ippdbPrintMetadatas(stdout, output, "rawDetrendImfile", !simple)) {
     790        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     791        psFree(output);
     792        return false;
     793    }
     794
     795    psFree(output);
    802796
    803797    return true;
Note: See TracChangeset for help on using the changeset viewer.