IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17570 for trunk/ippdb


Ignore:
Timestamp:
May 7, 2008, 3:47:34 PM (18 years ago)
Author:
jhoblitt
Message:

VERSION 1.1.33

Location:
trunk/ippdb
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippdb/configure.ac

    r17142 r17570  
    77AC_PREREQ(2.61)
    88
    9 AC_INIT([ippdb], [1.1.32], [pan-starrs.ifa.hawaii.edu])
     9AC_INIT([ippdb], [1.1.33], [pan-starrs.ifa.hawaii.edu])
    1010AC_CONFIG_SRCDIR([ippdb.pc.in])
    1111
  • trunk/ippdb/src/ippdb.c

    r17144 r17570  
    586586static void summitExpRowFree(summitExpRow *object);
    587587
    588 summitExpRow *summitExpRowAlloc(const char *exp_name, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, const char *uri, psS32 imfiles)
     588summitExpRow *summitExpRowAlloc(const char *exp_name, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, const char *uri, psS32 imfiles, psS16 fault)
    589589{
    590590    summitExpRow    *_object;
     
    600600    _object->uri = psStringCopy(uri);
    601601    _object->imfiles = imfiles;
     602    _object->fault = fault;
    602603
    603604    return _object;
     
    652653        return false;
    653654    }
     655    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "Key NOT NULL", 0)) {
     656        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
     657        psFree(md);
     658        return false;
     659    }
    654660
    655661    bool status = psDBCreateTable(dbh, SUMMITEXP_TABLE_NAME, md);
     
    665671}
    666672
    667 bool summitExpInsert(psDB * dbh, const char *exp_name, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, const char *uri, psS32 imfiles)
     673bool summitExpInsert(psDB * dbh, const char *exp_name, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, const char *uri, psS32 imfiles, psS16 fault)
    668674{
    669675    psMetadata *md = psMetadataAlloc();
     
    700706    if (!psMetadataAdd(md, PS_LIST_TAIL, "imfiles", PS_DATA_S32, NULL, imfiles)) {
    701707        psError(PS_ERR_UNKNOWN, false, "failed to add item imfiles");
     708        psFree(md);
     709        return false;
     710    }
     711    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) {
     712        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
    702713        psFree(md);
    703714        return false;
     
    726737bool summitExpInsertObject(psDB *dbh, summitExpRow *object)
    727738{
    728     return summitExpInsert(dbh, object->exp_name, object->camera, object->telescope, object->dateobs, object->exp_type, object->uri, object->imfiles);
     739    return summitExpInsert(dbh, object->exp_name, object->camera, object->telescope, object->dateobs, object->exp_type, object->uri, object->imfiles, object->fault);
    729740}
    730741
     
    834845        return false;
    835846    }
     847    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) {
     848        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
     849        psFree(md);
     850        return false;
     851    }
    836852
    837853
     
    878894        return false;
    879895    }
    880 
    881     return summitExpRowAlloc(exp_name, camera, telescope, dateobs, exp_type, uri, imfiles);
     896    psS16 fault = psMetadataLookupS16(&status, md, "fault");
     897    if (!status) {
     898        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault");
     899        return false;
     900    }
     901
     902    return summitExpRowAlloc(exp_name, camera, telescope, dateobs, exp_type, uri, imfiles, fault);
    882903}
    883904psArray *summitExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
  • trunk/ippdb/src/ippdb.h

    r17144 r17570  
    339339    char            *uri;
    340340    psS32           imfiles;
     341    psS16           fault;
    341342} summitExpRow;
    342343
     
    353354    const char      *exp_type,
    354355    const char      *uri,
    355     psS32           imfiles
     356    psS32           imfiles,
     357    psS16           fault
    356358);
    357359
     
    389391    const char      *exp_type,
    390392    const char      *uri,
    391     psS32           imfiles
     393    psS32           imfiles,
     394    psS16           fault
    392395);
    393396
  • trunk/ippdb/tests/alloc.c

    r17144 r17570  
    3636        summitExpRow    *object;
    3737
    38         object = summitExpRowAlloc("a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", -32    );
     38        object = summitExpRowAlloc("a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", -32, -16    );
    3939
    4040        if (!object) {
     
    6666        }
    6767        if (!object->imfiles == -32) {
     68            psFree(object);
     69            exit(EXIT_FAILURE);
     70        }
     71        if (!object->fault == -16) {
    6872            psFree(object);
    6973            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/insert.c

    r17144 r17570  
    2828        }
    2929
    30         if (!summitExpInsert(dbh, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", -32)) {
     30        if (!summitExpInsert(dbh, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", -32, -16)) {
    3131            exit(EXIT_FAILURE);
    3232        }
  • trunk/ippdb/tests/insertobject.c

    r17144 r17570  
    3636        }
    3737
    38         object = summitExpRowAlloc("a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", -32);
     38        object = summitExpRowAlloc("a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", -32, -16);
    3939        if (!object) {
    4040            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/metadatafromobject.c

    r17144 r17570  
    4646        bool            status;
    4747
    48         object = summitExpRowAlloc("a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", -32);
     48        object = summitExpRowAlloc("a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string", -32, -16);
    4949        if (!object) {
    5050            exit(EXIT_FAILURE);
     
    8282        }
    8383        if (!psMetadataLookupS32(&status, md, "imfiles") == -32) {
     84            psFree(md);
     85            exit(EXIT_FAILURE);
     86        }
    8487            psFree(md);
    8588            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/objectfrommetadata.c

    r17144 r17570  
    8282            exit(EXIT_FAILURE);
    8383        }
     84            psFree(md);
     85            exit(EXIT_FAILURE);
     86        }
    8487
    8588        object = summitExpObjectFromMetadata(md);
     
    115118        }
    116119        if (!object->imfiles == -32) {
     120            psFree(object);
     121            exit(EXIT_FAILURE);
     122        }
    117123            psFree(object);
    118124            exit(EXIT_FAILURE);
Note: See TracChangeset for help on using the changeset viewer.