IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9173


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

VERSION 0.0.41

Location:
trunk/ippdb
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippdb/configure.ac

    r9155 r9173  
    77AC_PREREQ(2.59)
    88
    9 AC_INIT([ippdb], [0.0.40], [pan-starrs.ifa.hawaii.edu])
     9AC_INIT([ippdb], [0.0.41], [pan-starrs.ifa.hawaii.edu])
    1010AC_CONFIG_SRCDIR([ippdb.pc.in])
    1111
  • 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)
  • trunk/ippdb/src/ippdb.h

    r9149 r9173  
    53955395    psS32           iteration;
    53965396    char            *det_type;
     5397    char            *state;
    53975398} detRunRow;
    53985399
     
    54045405detRunRow *detRunRowAlloc(
    54055406    psS32           iteration,
    5406     const char      *det_type
     5407    const char      *det_type,
     5408    const char      *state
    54075409);
    54085410
     
    54355437    psDB            *dbh,               ///< Database handle
    54365438    psS32           iteration,
    5437     const char      *det_type
     5439    const char      *det_type,
     5440    const char      *state
    54385441);
    54395442
     
    54575460    psDB            *dbh,               ///< Database handle
    54585461    psS32           *iteration,
    5459     char            **det_type
     5462    char            **det_type,
     5463    char            **state
    54605464);
    54615465
  • trunk/ippdb/tests/alloc.c

    r9149 r9173  
    937937        detRunRow       *object;
    938938
    939         object = detRunRowAlloc(-32, "a string"    );
     939        object = detRunRowAlloc(-32, "a string", "a string"    );
    940940
    941941        if (!object) {
     
    948948        }
    949949        if (strncmp(object->det_type, "a string", MAX_STRING_LENGTH)) {
     950            psFree(object);
     951            exit(EXIT_FAILURE);
     952        }
     953        if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) {
    950954            psFree(object);
    951955            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/insert.c

    r9149 r9173  
    343343        }
    344344
    345         if (!detRunInsert(dbh, -32, "a string")) {
     345        if (!detRunInsert(dbh, -32, "a string", "a string")) {
    346346            exit(EXIT_FAILURE);
    347347        }
  • trunk/ippdb/tests/insertobject.c

    r9149 r9173  
    498498        }
    499499
    500         object = detRunRowAlloc(-32, "a string");
     500        object = detRunRowAlloc(-32, "a string", "a string");
    501501        if (!object) {
    502502            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/metadatafromobject.c

    r9149 r9173  
    11151115        bool            status;
    11161116
    1117         object = detRunRowAlloc(-32, "a string");
     1117        object = detRunRowAlloc(-32, "a string", "a string");
    11181118        if (!object) {
    11191119            exit(EXIT_FAILURE);
     
    11321132        }
    11331133        if (strncmp(psMetadataLookupPtr(&status, md, "det_type"), "a string", MAX_STRING_LENGTH)) {
     1134            psFree(md);
     1135            exit(EXIT_FAILURE);
     1136        }
     1137        if (strncmp(psMetadataLookupPtr(&status, md, "state"), "a string", MAX_STRING_LENGTH)) {
    11341138            psFree(md);
    11351139            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/objectfrommetadata.c

    r9149 r9173  
    16971697            exit(EXIT_FAILURE);
    16981698        }
     1699        if (!psMetadataAddStr(md, PS_LIST_TAIL, "state", 0, NULL, "a string")) {
     1700            psFree(md);
     1701            exit(EXIT_FAILURE);
     1702        }
    16991703
    17001704        object = detRunObjectFromMetadata(md);
     
    17111715        }
    17121716        if (strncmp(object->det_type, "a string", MAX_STRING_LENGTH)) {
     1717            psFree(object);
     1718            exit(EXIT_FAILURE);
     1719        }
     1720        if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) {
    17131721            psFree(object);
    17141722            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/pop.c

    r9149 r9173  
    499499        psS32           iteration;
    500500        char            det_type[256];
    501 
    502         dbh = psDBInit("localhost", "test", NULL, "test");
    503         if (!dbh) {
    504             exit(EXIT_FAILURE);
    505         }
    506 
    507         if (!detRunPop(dbh, &iteration, (char **)&det_type)) {
     501        char            state[256];
     502
     503        dbh = psDBInit("localhost", "test", NULL, "test");
     504        if (!dbh) {
     505            exit(EXIT_FAILURE);
     506        }
     507
     508        if (!detRunPop(dbh, &iteration, (char **)&det_type, (char **)&state)) {
    508509            exit(EXIT_FAILURE);
    509510        }
Note: See TracChangeset for help on using the changeset viewer.