IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 15, 2009, 9:33:58 AM (17 years ago)
Author:
bills
Message:

add -clean argument to the exportrun modes. If set switch
state and data state from 'full' to 'cleaned'.
If no rows are found in -exportrun return error status for
the command

File:
1 edited

Legend:

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

    r23123 r23873  
    5050// 'scrubbed' is a virtual state equivalent to cleaned, but allows files to be removed
    5151// even if the config files is missing
     52
     53
     54// change the value for tableName.columName from 'full' to 'cleaned' if necessary
     55bool pxSetStateCleaned(const psString tableName, const psString columnName, psArray *rows)
     56{
     57    for (long i = 0; i < psArrayLength(rows); i++) {
     58        psMetadata *row = rows->data[i];
     59        psString state = psMetadataLookupStr(NULL, row, columnName);
     60        if (!state) {
     61            psError(PS_ERR_PROGRAMMING, false, "%s not found in row %" PRId64 " of table %s",
     62                columnName, i, tableName);
     63            return false;
     64        }
     65        if (!strcmp("full", state)) {
     66            // change full to cleaned
     67            psMetadataAddStr(row, PS_LIST_TAIL, columnName, PS_META_REPLACE, "", "cleaned");
     68        } else if (strcmp("cleaned", state)) {
     69            // if state isn't cleaned or full we can't set it to cleaned
     70            psError(PS_ERR_PROGRAMMING, true, "%s with state %s may not be exported cleaned",
     71                tableName, state);
     72            return false;
     73        }
     74    }
     75    return true;
     76}
Note: See TracChangeset for help on using the changeset viewer.