IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

VERSION 1.1.33

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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)
Note: See TracChangeset for help on using the changeset viewer.