IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9226


Ignore:
Timestamp:
Oct 4, 2006, 12:16:17 PM (20 years ago)
Author:
jhoblitt
Message:

update all database result handling so that we exit normally when no matching rows are found
change -toresid to return a 'det_uri'

File:
1 edited

Legend:

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

    r9214 r9226  
    1 #ifdef HAVE_CONFIG_H
     1#ifdef HAVB_CONFIG_H
    22#include <config.h>
    33#endif
     
    160160    psArray *output = p_psDBFetchResult(config->dbh);
    161161    if (!output) {
     162        psError(PS_ERR_UNKNOWN, false, "database error");
     163        return false;
     164    }
     165    if (!psArrayLength(output)) {
    162166        // XXX check psError here
    163167        psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
    164         return false;
     168        psFree(output);
     169        return true;
    165170    }
    166171
     
    768773    psArray *output = p_psDBFetchResult(config->dbh);
    769774    if (!output) {
     775        psError(PS_ERR_UNKNOWN, false, "database error");
     776        return false;
     777    }
     778    if (!psArrayLength(output)) {
    770779        // XXX check psError here
    771780        psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
    772         return false;
     781        psFree(output);
     782        return true;
    773783    }
    774784
     
    823833    if (!output) {
    824834        psError(PS_ERR_UNKNOWN, false, "database error");
    825         psFree(query);
     835        return false;
    826836    }
    827837    if (!psArrayLength(output)) {
     
    901911    if (!output) {
    902912        psError(PS_ERR_UNKNOWN, false, "database error");
    903         psFree(query);
     913        return false;
    904914    }
    905915    if (!psArrayLength(output)) {
     
    11861196    psArray *output = p_psDBFetchResult(config->dbh);
    11871197    if (!output) {
     1198        psError(PS_ERR_UNKNOWN, false, "database error");
     1199        return false;
     1200    }
     1201    if (!psArrayLength(output)) {
    11881202        // XXX check psError here
    11891203        psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
    1190         return false;
     1204        psFree(output);
     1205        return true;
    11911206    }
    11921207
     
    13301345    psArray *output = p_psDBFetchResult(config->dbh);
    13311346    if (!output) {
     1347        psError(PS_ERR_UNKNOWN, false, "database error");
     1348        return false;
     1349    }
     1350    psFree(output);
     1351    if (!psArrayLength(output)) {
    13321352        // XXX check psError here
    13331353        psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
    1334         return false;
    1335     }
    1336     psFree(output);
     1354        return true;
     1355    }
    13371356
    13381357    // create a new detProcessedImfile object
     
    14841503    psArray *output = p_psDBFetchResult(config->dbh);
    14851504    if (!output) {
     1505        psError(PS_ERR_UNKNOWN, false, "database error");
     1506        return false;
     1507    }
     1508    if (!psArrayLength(output)) {
    14861509        // XXX check psError here
    1487         psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
    1488         return false;
     1510        psError(PS_ERR_UNKNOWN, false, "no stackable detProcessedImfiles found");
     1511        psFree(output);
     1512        return true;
    14891513    }
    14901514
     
    15411565    psArray *output = p_psDBFetchResult(config->dbh);
    15421566    if (!output) {
     1567        psError(PS_ERR_UNKNOWN, false, "database error");
     1568        return false;
     1569    }
     1570    if (!psArrayLength(output)) {
    15431571        // XXX check psError here
    1544         psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
    1545         return false;
     1572        psError(PS_ERR_UNKNOWN, false, "no detProcessedImfile rows found");
     1573        psFree(output);
     1574        return true;
    15461575    }
    15471576
     
    19922021    psArray *output = p_psDBFetchResult(config->dbh);
    19932022    if (!output) {
     2023        psError(PS_ERR_UNKNOWN, false, "database error");
     2024        return false;
     2025    }
     2026    if (!psArrayLength(output)) {
    19942027        // XXX check psError here
    1995         psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
    1996         return false;
     2028        psError(PS_ERR_UNKNOWN, false, "no detStackedImfile rows found");
     2029        psFree(output);
     2030        return true;
    19972031    }
    19982032
     
    21672201    psArray *output = p_psDBFetchResult(config->dbh);
    21682202    if (!output) {
     2203        psError(PS_ERR_UNKNOWN, false, "database error");
     2204        return false;
     2205    }
     2206    if (!psArrayLength(output)) {
    21692207        // XXX check psError here
    2170         psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
    2171         return false;
     2208        psError(PS_ERR_UNKNOWN, false, "no detNormalizedStatImfile rows found");
     2209        psFree(output);
     2210        return true;
    21722211    }
    21732212
     
    22282267    psArray *output = p_psDBFetchResult(config->dbh);
    22292268    if (!output) {
     2269        psError(PS_ERR_UNKNOWN, false, "database error");
     2270        return false;
     2271    }
     2272    if (!psArrayLength(output)) {
    22302273        // XXX check psError here
    2231         psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
    2232         return false;
     2274        psError(PS_ERR_UNKNOWN, false, "no detStackedImfile rows found");
     2275        psFree(output);
     2276        return true;
    22332277    }
    22342278
     
    23532397    psArray *output = p_psDBFetchResult(config->dbh);
    23542398    if (!output) {
     2399        psError(PS_ERR_UNKNOWN, false, "database error");
     2400        return false;
     2401    }
     2402    if (!psArrayLength(output)) {
    23552403        // XXX check psError here
    2356         psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
    2357         return false;
     2404        psError(PS_ERR_UNKNOWN, false, "no normalizable detNormalizedStatImfiles found");
     2405        psFree(output);
     2406        return true;
    23582407    }
    23592408
     
    25552604    psArray *output = p_psDBFetchResult(config->dbh);
    25562605    if (!output) {
     2606        psError(PS_ERR_UNKNOWN, false, "database error");
     2607        return false;
     2608    }
     2609    if (!psArrayLength(output)) {
    25572610        // XXX check psError here
    25582611        psError(PS_ERR_UNKNOWN, false, "no pending detNormalizedStatImfile rows found");
    2559         return false;
     2612        psFree(output);
     2613        return true;
    25602614    }
    25612615
     
    26632717    if (!output) {
    26642718        psError(PS_ERR_UNKNOWN, false, "database error");
    2665         psFree(query);
     2719        return false;
    26662720    }
    26672721    if (!psArrayLength(output)) {
     
    28112865    if (!output) {
    28122866        psError(PS_ERR_UNKNOWN, false, "database error");
    2813         psFree(query);
     2867        return false;
    28142868    }
    28152869    if (!psArrayLength(output)) {
     
    29473001
    29483002    psString query = psStringCopy(
    2949         "SELECT"
     3003        "SELECT DISTINCT"
    29503004        "   detRun.iteration,"
    29513005        "   detRun.det_type,"
    29523006        "   detProcessedImfile.*,"
    2953         "   detNormalizedImfile.uri,"
     3007        "   detNormalizedImfile.uri AS det_uri,"
    29543008        "   rawDetrendExp.camera"
    29553009        " FROM detRun"
     
    29973051    psArray *output = p_psDBFetchResult(config->dbh);
    29983052    if (!output) {
     3053        psError(PS_ERR_UNKNOWN, false, "database error");
     3054        return false;
     3055    }
     3056    if (!psArrayLength(output)) {
    29993057        // XXX check psError here
    3000         psError(PS_ERR_UNKNOWN, false, "no pending rows found");
    3001         return false;
     3058        psError(PS_ERR_UNKNOWN, false, "no residable detNormalizedImfileis found");
     3059        psFree(output);
     3060        return true;
    30023061    }
    30033062
     
    33003359    psArray *output = p_psDBFetchResult(config->dbh);
    33013360    if (!output) {
     3361        psError(PS_ERR_UNKNOWN, false, "database error");
     3362        return false;
     3363    }
     3364    if (!psArrayLength(output)) {
    33023365        // XXX check psError here
    33033366        psError(PS_ERR_UNKNOWN, false, "no pending detNormalizedImfile rows found");
    3304         return false;
     3367        psFree(output);
     3368        return true;
    33053369    }
    33063370
     
    34723536    psArray *output = p_psDBFetchResult(config->dbh);
    34733537    if (!output) {
     3538        psError(PS_ERR_UNKNOWN, false, "database error");
     3539        return false;
     3540    }
     3541    if (!psArrayLength(output)) {
    34743542        // XXX check psError here
    34753543        psError(PS_ERR_UNKNOWN, false, "no detResidImfile rows found");
    3476         return false;
     3544        psFree(output);
     3545        return true;
    34773546    }
    34783547
     
    35833652    psArray *output = p_psDBFetchResult(config->dbh);
    35843653    if (!output) {
     3654        psError(PS_ERR_UNKNOWN, false, "database error");
     3655        return false;
     3656    }
     3657    if (!psArrayLength(output)) {
    35853658        // XXX check psError here
    3586         psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
    3587         return false;
     3659        psError(PS_ERR_UNKNOWN, false, "no residExpable detResidImfiles found");
     3660        psFree(output);
     3661        return true;
    35883662    }
    35893663
     
    37413815    psArray *output = p_psDBFetchResult(config->dbh);
    37423816    if (!output) {
     3817        psError(PS_ERR_UNKNOWN, false, "database error");
     3818        return false;
     3819    }
     3820    if (!psArrayLength(output)) {
    37433821        // XXX check psError here
    3744         psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
    3745         return false;
     3822        psError(PS_ERR_UNKNOWN, false, "no detResidImfile rows found");
     3823        psFree(output);
     3824        return true;
    37463825    }
    37473826
     
    39964075    psArray *output = p_psDBFetchResult(config->dbh);
    39974076    if (!output) {
     4077        psError(PS_ERR_UNKNOWN, false, "database error");
     4078        return false;
     4079    }
     4080    if (!psArrayLength(output)) {
    39984081        // XXX check psError here
    3999         psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
    4000         return false;
     4082        psError(PS_ERR_UNKNOWN, false, "no completed det runs found");
     4083        psFree(output);
     4084        return true;
    40014085    }
    40024086
     
    42884372    psArray *output = p_psDBFetchResult(config->dbh);
    42894373    if (!output) {
     4374        psError(PS_ERR_UNKNOWN, false, "database error");
     4375        return false;
     4376    }
     4377    if (!psArrayLength(output)) {
    42904378        // XXX check psError here
    42914379        psError(PS_ERR_UNKNOWN, false, "no pending completed detrun iterations found");
    4292         return false;
     4380        psFree(output);
     4381        return true;
    42934382    }
    42944383
     
    44864575    psArray *output = p_psDBFetchResult(config->dbh);
    44874576    if (!output) {
     4577        psError(PS_ERR_UNKNOWN, false, "database error");
     4578        return false;
     4579    }
     4580    if (!psArrayLength(output)) {
    44884581        // XXX check psError here
    44894582        psError(PS_ERR_UNKNOWN, false, "no completed detrun iterations found");
    4490         return false;
     4583        psFree(output);
     4584        return true;
    44914585    }
    44924586
Note: See TracChangeset for help on using the changeset viewer.