IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 3, 2006, 4:59:05 PM (20 years ago)
Author:
jhoblitt
Message:

VERSION 0.0.41

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippdb/src/ippdb.c

    r9149 r9173  
    1277012770static void detRunRowFree(detRunRow *object);
    1277112771
    12772 detRunRow *detRunRowAlloc(psS32 iteration, const char *det_type)
     12772detRunRow *detRunRowAlloc(psS32 iteration, const char *det_type, const char *state)
    1277312773{
    1277412774    detRunRow       *object;
     
    1277912779    object->iteration = iteration;
    1278012780    object->det_type = psStringCopy(det_type);
     12781    object->state = psStringCopy(state);
    1278112782
    1278212783    return object;
     
    1278612787{
    1278712788    psFree(object->det_type);
     12789    psFree(object->state);
    1278812790}
    1278912791
     
    1280912811        return false;
    1281012812    }
     12813    if (!psMetadataAddStr(md, PS_LIST_TAIL, "state", 0, "Key", "64")) {
     12814        psError(PS_ERR_UNKNOWN, false, "failed to add item state");
     12815        psFree(md);
     12816        return false;
     12817    }
    1281112818
    1281212819    status = psDBCreateTable(dbh, DETRUN_TABLE_NAME, md);
     
    1282212829}
    1282312830
    12824 bool detRunInsert(psDB * dbh, psS32 iteration, const char *det_type)
     12831bool detRunInsert(psDB * dbh, psS32 iteration, const char *det_type, const char *state)
    1282512832{
    1282612833    psMetadata      *md;
     
    1283512842    if (!psMetadataAddStr(md, PS_LIST_TAIL, "det_type", 0, NULL, det_type)) {
    1283612843        psError(PS_ERR_UNKNOWN, false, "failed to add item det_type");
     12844        psFree(md);
     12845        return false;
     12846    }
     12847    if (!psMetadataAddStr(md, PS_LIST_TAIL, "state", 0, NULL, state)) {
     12848        psError(PS_ERR_UNKNOWN, false, "failed to add item state");
    1283712849        psFree(md);
    1283812850        return false;
     
    1285912871    return deleted;
    1286012872}
    12861 bool detRunPop(psDB *dbh, psS32 *iteration, char **det_type)
     12873bool detRunPop(psDB *dbh, psS32 *iteration, char **det_type, char **state)
    1286212874{
    1286312875    psArray         *rowSet;
     
    1291512927        return false;
    1291612928    }
     12929    *state = psMetadataLookupPtr(&status, row, "state");
     12930    if (!status) {
     12931        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item state");
     12932        psFree(row);
     12933        return false;
     12934    }
    1291712935
    1291812936    psFree(row);
     
    1292312941bool detRunInsertObject(psDB *dbh, detRunRow *object)
    1292412942{
    12925     return detRunInsert(dbh, object->iteration, object->det_type);
     12943    return detRunInsert(dbh, object->iteration, object->det_type, object->state);
    1292612944}
    1292712945
     
    1294112959    psS32           iteration;
    1294212960    char            det_type[256];
    12943 
    12944     if (!detRunPop(dbh, &iteration, (char **)&det_type)) {
     12961    char            state[256];
     12962
     12963    if (!detRunPop(dbh, &iteration, (char **)&det_type, (char **)&state)) {
    1294512964        psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
    1294612965        return NULL;
    1294712966    }
    1294812967
    12949     return detRunRowAlloc(iteration, det_type);
     12968    return detRunRowAlloc(iteration, det_type, state);
    1295012969}
    1295112970
     
    1305613075        return NULL;
    1305713076    }
     13077    if (!psMetadataAddStr(md, PS_LIST_TAIL, "state", 0, NULL, object->state)) {
     13078        psError(PS_ERR_UNKNOWN, false, "failed to add item state");
     13079        psFree(md);
     13080        return NULL;
     13081    }
    1305813082
    1305913083    return md;
     
    1306513089    psS32           iteration;
    1306613090    char            *det_type;
     13091    char            *state;
    1306713092
    1306813093    iteration = psMetadataLookupS32(&status, md, "iteration");
     
    1307613101        return false;
    1307713102    }
    13078 
    13079     return detRunRowAlloc(iteration, det_type);
     13103    state = psMetadataLookupPtr(&status, md, "state");
     13104    if (!status) {
     13105        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item state");
     13106        return false;
     13107    }
     13108
     13109    return detRunRowAlloc(iteration, det_type, state);
    1308013110}
    1308113111psArray *detRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Note: See TracChangeset for help on using the changeset viewer.