IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12086


Ignore:
Timestamp:
Feb 27, 2007, 12:06:18 PM (19 years ago)
Author:
jhoblitt
Message:

move SQL out of regtool into separate data files

Location:
trunk/ippTools
Files:
7 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/configure.ac

    r12059 r12086  
    4747fi
    4848
     49dnl check for perl
     50AC_PATH_PROG([PERL], [perl], [missing])
     51if test "$PERL" = "missing" ; then
     52  AC_MSG_ERROR([perl is required])
     53fi
     54
    4955IPP_STDOPTS
    5056CFLAGS="${CFLAGS=} -Wall -Werror -std=c99"
  • trunk/ippTools/src/regtool.c

    r12025 r12086  
    2525
    2626#include "pxtools.h"
     27#include "pxdata.h"
    2728#include "regtool.h"
    2829
     
    112113    // that should be checked for
    113114
    114     psString query = psStringCopy(
    115         "SELECT\n"
    116         "   newImfile.*,\n"
    117         "   newExp.workdir\n"
    118         " FROM newImfile\n"
    119         " LEFT JOIN newExp\n"
    120         "   USING(exp_tag)\n"
    121         " LEFT JOIN rawExp\n"
    122         "   USING(exp_tag)\n"
    123         " WHERE\n"
    124         "   newExp.exp_tag is NOT NULL\n"
    125         "   AND rawExp.exp_tag IS NULL\n"
    126     );
     115    psString query = pxDataGet("regtool_pendingimfile.sql");
     116    if (!query) {
     117        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statment");
     118        return false;
     119    }
    127120
    128121    // treat limit == 0 as "no limit"
     
    184177    PS_ASSERT_PTR_NON_NULL(config, false);
    185178
    186     // XXX search by the whole frame some imfiles without a newExp don't get
    187     // processed -- this may not be the correct thing to do
    188     psString query = psStringCopy(
    189         "SELECT\n"
    190         "   *\n"
    191         " FROM\n"
    192         "   (SELECT newImfile.* FROM newImfile\n"
    193         "       LEFT JOIN newExp USING(exp_tag)\n"
    194         "       LEFT JOIN rawExp USING(exp_tag)\n"
    195         "       WHERE newExp.exp_tag IS NOT NULL\n"
    196         "       AND rawExp.exp_tag IS NULL) as Foo\n"
    197         ); // WHERE class is generated from exp_tag, class, & class_id
     179    psString query = pxDataGet("regtool_find_unprocessed_imfile.sql");
     180    if (!query) {
     181        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statment");
     182        return false;
     183    }
    198184
    199185    {
     
    363349    }
    364350
    365     // find all rawImfiles matching the default query
    366     psString query = psStringCopy(
    367         "SELECT\n"
    368         "   *\n"
    369         " FROM rawImfile\n"
    370         " WHERE rawImfile.exp_tag is NOT NULL\n" //bogus conditional so there is a where clause to append to
    371     );
     351    psString query = pxDataGet("regtool_processedimfile.sql");
     352    if (!query) {
     353        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statment");
     354        return false;
     355    }
    372356
    373357    if (config->where) {
     
    479463    // have ALL of their imfiles in rawImfile (by count)
    480464    // and have no associated imfiles left in newImfile
    481 
    482     psString query = psStringCopy(
    483         "SELECT"
    484         "   newExp.*"
    485         " FROM newExp"
    486         " LEFT JOIN newImfile"
    487         "   USING(exp_tag)"
    488         " LEFT JOIN rawExp"
    489         "   USING(exp_tag)"
    490         " WHERE"
    491         "   newImfile.exp_tag IS NULL"
    492         "   AND rawExp.exp_tag IS NULL"
    493         "   AND newExp.imfiles ="
    494         "   (SELECT COUNT(exp_tag) FROM rawImfile"
    495         "       WHERE"
    496         "           rawImfile.exp_tag = newExp.exp_tag"
    497         "           AND rawImfile.fault = 0)"
    498     );
     465    psString query = pxDataGet("regtool_pendingexp.sql");
     466    if (!query) {
     467        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statment");
     468        return false;
     469    }
    499470
    500471    // treat limit == 0 as "no limit"
     
    578549    }
    579550
    580    char *query =
    581         "SELECT"
    582         "   newExp.*"
    583         " FROM newExp"
    584         " LEFT JOIN newImfile"
    585         "   USING(exp_tag)"
    586         " LEFT JOIN rawExp"
    587         "   USING(exp_tag)"
    588         " WHERE"
    589         "   newExp.exp_tag IS NOT NULL"
    590         "   AND newImfile.exp_tag IS NULL"
    591         "   AND rawExp.exp_tag IS NULL"
    592         "   AND newExp.imfiles ="
    593         "   (SELECT COUNT(exp_tag) FROM rawImfile"
    594         "       WHERE rawImfile.exp_tag = newExp.exp_tag)"
    595         "   AND newExp.exp_tag = '%s'";
     551    psString query = pxDataGet("regtool_find_unprocessed_exp.sql");
     552    if (!query) {
     553        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statment");
     554        return false;
     555    }
    596556
    597557    if (!p_psDBRunQuery(config->dbh, query, exp_tag)) {
     
    794754    }
    795755
    796     // find all rawImfiles matching the default query
    797     psString query = psStringCopy(
    798         "SELECT\n"
    799         "   *\n"
    800         " FROM rawExp\n"
    801         " WHERE\n"
    802         "   rawExp.exp_tag IS NOT NULL\n" // bogus where clause
    803     );
     756    psString query = pxDataGet("regtool_processedexp.sql");
     757    if (!query) {
     758        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statment");
     759        return false;
     760    }
    804761
    805762    if (config->where) {
Note: See TracChangeset for help on using the changeset viewer.