IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 8, 2007, 4:08:31 PM (20 years ago)
Author:
jhoblitt
Message:

VERSION to 0.0.69

File:
1 edited

Legend:

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

    r10753 r10989  
    28002800static void newExpRowFree(newExpRow *object);
    28012801
    2802 newExpRow *newExpRowAlloc(const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles)
     2802newExpRow *newExpRowAlloc(const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles, psS16 fault)
    28032803{
    28042804    newExpRow       *_object;
     
    28142814    _object->exp_type = psStringCopy(exp_type);
    28152815    _object->imfiles = imfiles;
     2816    _object->fault = fault;
    28162817
    28172818    return _object;
     
    28662867        return false;
    28672868    }
     2869    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) {
     2870        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
     2871        psFree(md);
     2872        return false;
     2873    }
    28682874
    28692875    bool status = psDBCreateTable(dbh, NEWEXP_TABLE_NAME, md);
     
    28792885}
    28802886
    2881 bool newExpInsert(psDB * dbh, const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles)
     2887bool newExpInsert(psDB * dbh, const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles, psS16 fault)
    28822888{
    28832889    psMetadata *md = psMetadataAlloc();
     
    29142920    if (!psMetadataAdd(md, PS_LIST_TAIL, "imfiles", PS_DATA_S32, NULL, imfiles)) {
    29152921        psError(PS_ERR_UNKNOWN, false, "failed to add item imfiles");
     2922        psFree(md);
     2923        return false;
     2924    }
     2925    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) {
     2926        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
    29162927        psFree(md);
    29172928        return false;
     
    29402951bool newExpInsertObject(psDB *dbh, newExpRow *object)
    29412952{
    2942     return newExpInsert(dbh, object->exp_tag, object->exp_id, object->camera, object->telescope, object->dateobs, object->exp_type, object->imfiles);
     2953    return newExpInsert(dbh, object->exp_tag, object->exp_id, object->camera, object->telescope, object->dateobs, object->exp_type, object->imfiles, object->fault);
    29432954}
    29442955
     
    30483059        return false;
    30493060    }
     3061    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) {
     3062        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
     3063        psFree(md);
     3064        return false;
     3065    }
    30503066
    30513067
     
    30923108        return false;
    30933109    }
    3094 
    3095     return newExpRowAlloc(exp_tag, exp_id, camera, telescope, dateobs, exp_type, imfiles);
     3110    psS16 fault = psMetadataLookupS16(&status, md, "fault");
     3111    if (!status) {
     3112        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault");
     3113        return false;
     3114    }
     3115
     3116    return newExpRowAlloc(exp_tag, exp_id, camera, telescope, dateobs, exp_type, imfiles, fault);
    30963117}
    30973118psArray *newExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     
    32053226static void newImfileRowFree(newImfileRow *object);
    32063227
    3207 newImfileRow *newImfileRowAlloc(const char *exp_tag, const char *class, const char *class_id, const char *uri)
     3228newImfileRow *newImfileRowAlloc(const char *exp_tag, const char *class, const char *class_id, const char *uri, psS16 fault)
    32083229{
    32093230    newImfileRow    *_object;
     
    32163237    _object->class_id = psStringCopy(class_id);
    32173238    _object->uri = psStringCopy(uri);
     3239    _object->fault = fault;
    32183240
    32193241    return _object;
     
    32513273        return false;
    32523274    }
     3275    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) {
     3276        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
     3277        psFree(md);
     3278        return false;
     3279    }
    32533280
    32543281    bool status = psDBCreateTable(dbh, NEWIMFILE_TABLE_NAME, md);
     
    32643291}
    32653292
    3266 bool newImfileInsert(psDB * dbh, const char *exp_tag, const char *class, const char *class_id, const char *uri)
     3293bool newImfileInsert(psDB * dbh, const char *exp_tag, const char *class, const char *class_id, const char *uri, psS16 fault)
    32673294{
    32683295    psMetadata *md = psMetadataAlloc();
     
    32843311    if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, uri)) {
    32853312        psError(PS_ERR_UNKNOWN, false, "failed to add item uri");
     3313        psFree(md);
     3314        return false;
     3315    }
     3316    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) {
     3317        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
    32863318        psFree(md);
    32873319        return false;
     
    33103342bool newImfileInsertObject(psDB *dbh, newImfileRow *object)
    33113343{
    3312     return newImfileInsert(dbh, object->exp_tag, object->class, object->class_id, object->uri);
     3344    return newImfileInsert(dbh, object->exp_tag, object->class, object->class_id, object->uri, object->fault);
    33133345}
    33143346
     
    34033435        return false;
    34043436    }
     3437    if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) {
     3438        psError(PS_ERR_UNKNOWN, false, "failed to add item fault");
     3439        psFree(md);
     3440        return false;
     3441    }
    34053442
    34063443
     
    34323469        return false;
    34333470    }
    3434 
    3435     return newImfileRowAlloc(exp_tag, class, class_id, uri);
     3471    psS16 fault = psMetadataLookupS16(&status, md, "fault");
     3472    if (!status) {
     3473        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault");
     3474        return false;
     3475    }
     3476
     3477    return newImfileRowAlloc(exp_tag, class, class_id, uri, fault);
    34363478}
    34373479psArray *newImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Note: See TracChangeset for help on using the changeset viewer.