IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 27, 2007, 2:19:32 PM (19 years ago)
Author:
jhoblitt
Message:

move SQL out of chiptool into separate data files

File:
1 edited

Legend:

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

    r12093 r12096  
    2727
    2828#include "pxtools.h"
     29#include "pxdata.h"
    2930#include "chiptool.h"
    3031
     
    221222    // XXX does this need to be constrained so that it won't return any results
    222223    // if a match chipPendingExp hasn't been registered?
    223     psString query = psStringCopy(
    224             "SELECT"
    225             "   chipPendingImfile.*,"
    226             "   rawExp.camera,"
    227             "   rawExp.workdir"
    228             " FROM chipPendingImfile"
    229             " JOIN chipPendingExp"
    230             "   USING(exp_tag)"
    231             " JOIN rawExp"
    232             "   USING(exp_tag)"
    233             " LEFT JOIN chipMask"
    234             "   ON chipPendingExp.label = chipMask.label"
    235             " WHERE"
    236             "   chipMask.label IS NULL"
    237         );
     224    psString query = pxDataGet("chiptool_pendingimfile.sql");
     225    if (!query) {
     226        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     227        return false;
     228    }
    238229
    239230    if (config->where) {
     
    307298    // if so move the chipPendingExp(s) to chipProcessedExp
    308299
    309     psString query = psStringCopy(
    310         "SELECT DISTINCT"
    311         "   chipPendingImfile.*"
    312         " FROM chipPendingImfile "
    313         " LEFT JOIN chipProcessedImfile"
    314         "   USING(exp_tag, class_id)"
    315         " WHERE"
    316         "  chipProcessedImfile.exp_tag IS NULL"
    317         "  AND chipProcessedImfile.class_id IS NULL"
    318         );
     300    psString query = pxDataGet("chiptool_find_unprocessed_imfile.pl");
     301    if (!query) {
     302        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     303        return false;
     304    }
     305
    319306    {
    320307        psMetadata *where = psMetadataAlloc();
     
    475462    // XXX does this need to be constrained so that it won't return any results
    476463    // if a match chipPendingExp hasn't been registered?
    477     psString query = psStringCopy(
    478             "SELECT"
    479             "   chipProcessedImfile.*,"
    480             "   rawExp.camera,"
    481             "   rawExp.workdir"
    482             " FROM chipProcessedImfile"
    483             " JOIN rawExp"
    484             "   USING(exp_tag)"
    485             " WHERE "
    486             "   chipProcessedImfile.exp_tag is NOT NULL" // bogus test -- just here so there there is a 'WHERE' stmt to append conditionals too
    487         );
     464    psString query = pxDataGet("chiptool_processedimfile.sql");
     465    if (!query) {
     466        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     467        return false;
     468    }
    488469
    489470    if (config->where) {
     
    673654    // look for completed chipPendingExp
    674655    // migrate them to chipProccessedExp & camPendingExp
    675 
    676     // select * from chipPendingExp
    677     // where exp_tag is not in chipProcessedExp
    678     // where exp_tag is not in chipPendingImfile
    679     // where the number of entries in chipProccessedImfile matches the .imfiles
    680     // entry in rawExp
    681     psString query = psStringCopy(
    682         "SELECT DISTINCT"
    683         "   chipPendingExp.*,"
    684         "   rawExp.imfiles,"
    685         "   chipProcessedImfile.class_id"
    686         " FROM chipPendingExp"
    687         " JOIN rawExp"
    688         "   ON chipPendingExp.exp_tag = rawExp.exp_tag"
    689         " LEFT JOIN chipProcessedExp"
    690         "   ON chipPendingExp.exp_tag = chipProcessedExp.exp_tag"
    691         " LEFT JOIN chipPendingImfile"
    692         "   ON chipPendingExp.exp_tag = chipPendingImfile.exp_tag"
    693         " LEFT JOIN chipProcessedImfile"
    694         "   ON chipPendingExp.exp_tag = chipProcessedImfile.exp_tag"
    695         " WHERE"
    696         "  chipProcessedExp.exp_tag IS NULL"
    697         "  AND chipPendingImfile.exp_tag IS NULL"
    698         "  AND chipProcessedImfile.exp_tag IS NOT NULL"
    699         " GROUP BY"
    700         "   chipPendingExp.exp_tag"
    701         " HAVING rawExp.imfiles = COUNT(chipProcessedImfile.class_id)"
    702         );
     656    psString query = pxDataGet("chiptool_completely_processed_exp.sql");
     657    if (!query) {
     658        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
     659        return false;
     660    }
    703661
    704662    if (!p_psDBRunQuery(config->dbh, query)) {
Note: See TracChangeset for help on using the changeset viewer.