IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12096


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

move SQL out of chiptool into separate data files

Location:
trunk/ippTools
Files:
4 added
2 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)) {
  • trunk/ippTools/src/regtool.c

    r12092 r12096  
    115115    psString query = pxDataGet("regtool_pendingimfile.sql");
    116116    if (!query) {
    117         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statment");
     117        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    118118        return false;
    119119    }
     
    180180    psString query = pxDataGet("regtool_find_unprocessed_imfile.sql");
    181181    if (!query) {
    182         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statment");
     182        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    183183        return false;
    184184    }
     
    352352    psString query = pxDataGet("regtool_processedimfile.sql");
    353353    if (!query) {
    354         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statment");
     354        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    355355        return false;
    356356    }
     
    466466    psString query = pxDataGet("regtool_pendingexp.sql");
    467467    if (!query) {
    468         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statment");
     468        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    469469        return false;
    470470    }
     
    553553    psString query = pxDataGet("regtool_find_unprocessed_exp.sql");
    554554    if (!query) {
    555         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statment");
     555        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    556556        return false;
    557557    }
     
    559559    if (!p_psDBRunQuery(config->dbh, query, exp_tag)) {
    560560        psError(PS_ERR_UNKNOWN, false, "database error");
    561         return false;
    562     }
     561        psFree(query);
     562        return false;
     563    }
     564    psFree(query);
    563565
    564566    psArray *output = p_psDBFetchResult(config->dbh);
     
    758760    psString query = pxDataGet("regtool_processedexp.sql");
    759761    if (!query) {
    760         psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statment");
     762        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
    761763        return false;
    762764    }
Note: See TracChangeset for help on using the changeset viewer.