IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 11, 2013, 12:16:06 PM (13 years ago)
Author:
bills
Message:

handle reverting faults for camRuns in state update

File:
1 edited

Legend:

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

    r35770 r35799  
    938938    }
    939939
     940    psString whereClause = NULL;
    940941    {
    941942        psString query = pxDataGet("camtool_revertprocessedexp.sql");
     
    952953        // use psDBGenerateWhereConditionalSQL with AND ... because the SQL ends in a WHERE
    953954        if (where && psListLength(where->list)) {
    954             psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);
     955            whereClause = psDBGenerateWhereConditionSQL(where, NULL);
    955956            psStringAppend(&query, " AND %s", whereClause);
    956             psFree(whereClause);
    957957        }
    958958
     
    977977    }
    978978    psLogMsg("camtool", PS_LOG_INFO, "Deleted %d camProcessedExps", numDeleted);
     979
     980    {
     981        psString query = pxDataGet("camtool_revertupdatedexp.sql");
     982        if (!query) {
     983            psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     984            return false;
     985        }
     986
     987        if (whereClause) {
     988            psStringAppend(&query, "\n AND %s", whereClause);
     989            psFree(whereClause);
     990        }
     991
     992        if (!p_psDBRunQuery(config->dbh, query)) {
     993            psError(PS_ERR_UNKNOWN, false, "database error");
     994            psFree(query);
     995            return false;
     996        }
     997        psFree(query);
     998    }
     999    int numUpdated = psDBAffectedRows(config->dbh);
     1000    psLogMsg("camtool", PS_LOG_INFO, "Updated %d camProcessedExps", numUpdated);
    9791001
    9801002    return true;
Note: See TracChangeset for help on using the changeset viewer.