IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24736


Ignore:
Timestamp:
Jul 9, 2009, 1:12:40 PM (17 years ago)
Author:
Paul Price
Message:

Only set state to 'full' if there was no fault.

File:
1 edited

Legend:

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

    r24664 r24736  
    247247            psError(PS_ERR_UNKNOWN, false, "failed to print array");
    248248            psFree(output);
    249             psFree(where);
     249            psFree(where);
    250250            return false;
    251251        }
     
    379379        psStringSubstitute(&thisInsert, skycell_id, "@SKYCELL_ID@");
    380380
    381         if (randomLimit > 0) {
    382           psString limString = NULL;
    383           psStringAppend(&limString, "%d", randomLimit);
    384           psStringSubstitute(&thisInsert, limString, "@RANDOM_LIMIT@");
    385           psFree(limString);
    386         }
     381        if (randomLimit > 0) {
     382          psString limString = NULL;
     383          psStringAppend(&limString, "%d", randomLimit);
     384          psStringSubstitute(&thisInsert, limString, "@RANDOM_LIMIT@");
     385          psFree(limString);
     386        }
    387387
    388388        // XXX this insert uses a select to generate the list of warp_ids for the stack,
     
    404404
    405405# if (0)
    406         {
    407           psArray *output = p_psDBFetchResult(config->dbh);
    408           if (!output) {
    409             psErrorCode err = psErrorCodeLast();
    410             switch (err) {
    411             case PS_ERR_DB_CLIENT:
    412               psError(PXTOOLS_ERR_SYS, false, "database error");
    413             case PS_ERR_DB_SERVER:
    414               psError(PXTOOLS_ERR_PROG, false, "database error");
    415             default:
    416               psError(PXTOOLS_ERR_PROG, false, "unknown error");
    417             }
    418             psFree(where);
    419             return false;
    420           }
    421           if (!psArrayLength(output)) {
    422             psWarning("stacktool (definebyquery, insert): no rows found");
    423             psFree(output);
    424             psFree(where);
    425             return true;
    426           }
    427           // negative simple so the default is true
    428           if (!ippdbPrintMetadatas(stdout, output, "stackSkycells", !simple)) {
    429             psError(PS_ERR_UNKNOWN, false, "failed to print array");
    430             psFree(output);
    431             psFree(where);
    432             return false;
    433           }
    434           psFree(output);
    435           psFree(where);
    436           return true;
    437         }
     406        {
     407          psArray *output = p_psDBFetchResult(config->dbh);
     408          if (!output) {
     409            psErrorCode err = psErrorCodeLast();
     410            switch (err) {
     411            case PS_ERR_DB_CLIENT:
     412              psError(PXTOOLS_ERR_SYS, false, "database error");
     413            case PS_ERR_DB_SERVER:
     414              psError(PXTOOLS_ERR_PROG, false, "database error");
     415            default:
     416              psError(PXTOOLS_ERR_PROG, false, "unknown error");
     417            }
     418            psFree(where);
     419            return false;
     420          }
     421          if (!psArrayLength(output)) {
     422            psWarning("stacktool (definebyquery, insert): no rows found");
     423            psFree(output);
     424            psFree(where);
     425            return true;
     426          }
     427          // negative simple so the default is true
     428          if (!ippdbPrintMetadatas(stdout, output, "stackSkycells", !simple)) {
     429            psError(PS_ERR_UNKNOWN, false, "failed to print array");
     430            psFree(output);
     431            psFree(where);
     432            return false;
     433          }
     434          psFree(output);
     435          psFree(where);
     436          return true;
     437        }
    438438# endif
    439439
     
    828828    }
    829829
    830     if (!setstackRunState(config, stack_id, "full")) {
    831         if (!psDBRollback(config->dbh)) {
    832             psError(PS_ERR_UNKNOWN, false, "database error");
    833         }
    834         psError(PS_ERR_UNKNOWN, false, "failed to change stackRun's state");
    835         return false;
     830    if (fault == 0) {
     831        if (!setstackRunState(config, stack_id, "full")) {
     832            if (!psDBRollback(config->dbh)) {
     833                psError(PS_ERR_UNKNOWN, false, "database error");
     834            }
     835            psError(PS_ERR_UNKNOWN, false, "failed to change stackRun's state");
     836            return false;
     837        }
    836838    }
    837839
Note: See TracChangeset for help on using the changeset viewer.