IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9970


Ignore:
Timestamp:
Nov 13, 2006, 5:15:56 PM (20 years ago)
Author:
jhoblitt
Message:

VERSION 0.0.55

Location:
trunk/ippdb
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippdb/configure.ac

    r9796 r9970  
    77AC_PREREQ(2.59)
    88
    9 AC_INIT([ippdb], [0.0.54], [pan-starrs.ifa.hawaii.edu])
     9AC_INIT([ippdb], [0.0.55], [pan-starrs.ifa.hawaii.edu])
    1010AC_CONFIG_SRCDIR([ippdb.pc.in])
    1111
  • trunk/ippdb/src/ippdb.c

    r9796 r9970  
    234234static void summitExpRowFree(summitExpRow *object);
    235235
    236 summitExpRow *summitExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, const char *uri)
     236summitExpRow *summitExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, psTime* time, const char *exp_type, const char *uri)
    237237{
    238238    summitExpRow    *_object;
     
    244244    _object->camera = psStringCopy(camera);
    245245    _object->telescope = psStringCopy(telescope);
     246    _object->time = psTimeCopy(time);
    246247    _object->exp_type = psStringCopy(exp_type);
    247248    _object->uri = psStringCopy(uri);
     
    255256    psFree(object->camera);
    256257    psFree(object->telescope);
     258    psFree(object->time);
    257259    psFree(object->exp_type);
    258260    psFree(object->uri);
     
    277279        return false;
    278280    }
     281    psTime* time = psTimeFromISO("", PS_TIME_UTC);
     282    if (!psMetadataAdd(md, PS_LIST_TAIL, "time", PS_DATA_TIME, NULL, time)) {
     283        psFree(time);
     284        psError(PS_ERR_UNKNOWN, false, "failed to add item time");
     285        psFree(md);
     286        return false;
     287    }
     288    psFree(time);
    279289    if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_type", PS_DATA_STRING, NULL, "64")) {
    280290        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_type");
     
    300310}
    301311
    302 bool summitExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, const char *uri)
     312bool summitExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, psTime* time, const char *exp_type, const char *uri)
    303313{
    304314    psMetadata *md = psMetadataAlloc();
     
    315325    if (!psMetadataAdd(md, PS_LIST_TAIL, "telescope", PS_DATA_STRING, NULL, telescope)) {
    316326        psError(PS_ERR_UNKNOWN, false, "failed to add item telescope");
     327        psFree(md);
     328        return false;
     329    }
     330    if (!psMetadataAdd(md, PS_LIST_TAIL, "time", PS_DATA_TIME, NULL, time)) {
     331        psError(PS_ERR_UNKNOWN, false, "failed to add item time");
    317332        psFree(md);
    318333        return false;
     
    351366bool summitExpInsertObject(psDB *dbh, summitExpRow *object)
    352367{
    353     return summitExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->uri);
     368    return summitExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->time, object->exp_type, object->uri);
    354369}
    355370
     
    439454        return false;
    440455    }
     456    if (!psMetadataAdd(md, PS_LIST_TAIL, "time", PS_DATA_TIME, NULL, object->time)) {
     457        psError(PS_ERR_UNKNOWN, false, "failed to add item time");
     458        psFree(md);
     459        return false;
     460    }
    441461    if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_type", PS_DATA_STRING, NULL, object->exp_type)) {
    442462        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_type");
     
    473493        return false;
    474494    }
     495    psTime* time = psMetadataLookupPtr(&status, md, "time");
     496    if (!status) {
     497        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item time");
     498        return false;
     499    }
    475500    char* exp_type = psMetadataLookupPtr(&status, md, "exp_type");
    476501    if (!status) {
     
    484509    }
    485510
    486     return summitExpRowAlloc(exp_id, camera, telescope, exp_type, uri);
     511    return summitExpRowAlloc(exp_id, camera, telescope, time, exp_type, uri);
    487512}
    488513psArray *summitExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
  • trunk/ippdb/src/ippdb.h

    r9796 r9970  
    134134    char            *camera;
    135135    char            *telescope;
     136    psTime*         time;
    136137    char            *exp_type;
    137138    char            *uri;
     
    147148    const char      *camera,
    148149    const char      *telescope,
     150    psTime*         time,
    149151    const char      *exp_type,
    150152    const char      *uri
     
    181183    const char      *camera,
    182184    const char      *telescope,
     185    psTime*         time,
    183186    const char      *exp_type,
    184187    const char      *uri
  • trunk/ippdb/tests/alloc.c

    r9788 r9970  
    1111        summitExpRow    *object;
    1212
    13         object = summitExpRowAlloc("a string", "a string", "a string", "a string", "a string"    );
     13        object = summitExpRowAlloc("a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string"    );
    1414
    1515        if (!object) {
     
    2626        }
    2727        if (strncmp(object->telescope, "a string", MAX_STRING_LENGTH)) {
     28            psFree(object);
     29            exit(EXIT_FAILURE);
     30        }
    2831            psFree(object);
    2932            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/insert.c

    r9788 r9970  
    1313        }
    1414
    15         if (!summitExpInsert(dbh, "a string", "a string", "a string", "a string", "a string")) {
     15        if (!summitExpInsert(dbh, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string")) {
    1616            exit(EXIT_FAILURE);
    1717        }
  • trunk/ippdb/tests/insertobject.c

    r9788 r9970  
    1414        }
    1515
    16         object = summitExpRowAlloc("a string", "a string", "a string", "a string", "a string");
     16        object = summitExpRowAlloc("a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string");
    1717        if (!object) {
    1818            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/metadatafromobject.c

    r9788 r9970  
    1313        bool            status;
    1414
    15         object = summitExpRowAlloc("a string", "a string", "a string", "a string", "a string");
     15        object = summitExpRowAlloc("a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string");
    1616        if (!object) {
    1717            exit(EXIT_FAILURE);
     
    3434        }
    3535        if (strncmp(psMetadataLookupPtr(&status, md, "telescope"), "a string", MAX_STRING_LENGTH)) {
     36            psFree(md);
     37            exit(EXIT_FAILURE);
     38        }
    3639            psFree(md);
    3740            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/objectfrommetadata.c

    r9788 r9970  
    2525            exit(EXIT_FAILURE);
    2626        }
     27            psFree(md);
     28            exit(EXIT_FAILURE);
     29        }
    2730        if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_type", 0, NULL, "a string")) {
    2831            psFree(md);
     
    5154        }
    5255        if (strncmp(object->telescope, "a string", MAX_STRING_LENGTH)) {
     56            psFree(object);
     57            exit(EXIT_FAILURE);
     58        }
    5359            psFree(object);
    5460            exit(EXIT_FAILURE);
Note: See TracChangeset for help on using the changeset viewer.