IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8148


Ignore:
Timestamp:
Aug 4, 2006, 1:04:56 PM (20 years ago)
Author:
jhoblitt
Message:

VERSION 0.0.13

Location:
branches/jhoblitt/ippdb
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/jhoblitt/ippdb/configure.ac

    r8122 r8148  
    11AC_PREREQ(2.59)
    22
    3 AC_INIT([ippdb], [0.0.12], [pan-starrs.ifa.hawaii.edu])
     3AC_INIT([ippdb], [0.0.13], [pan-starrs.ifa.hawaii.edu])
    44AC_CONFIG_SRCDIR([ippdb.pc.in])
    55
  • branches/jhoblitt/ippdb/src/ippdb.c

    r8122 r8148  
    1466914669static void detResidImfileAnalysisRowFree(detResidImfileAnalysisRow *object);
    1467014670
    14671 detResidImfileAnalysisRow *detResidImfileAnalysisRowAlloc(psS32 det_id, psS32 iteration, const char *exp_id, const char *class_id, const char *recipe)
     14671detResidImfileAnalysisRow *detResidImfileAnalysisRowAlloc(psS32 det_id, psS32 iteration, const char *exp_id, const char *class_id, const char *recipe, const char *uri, const char *b1_uri, const char *b2_uri)
    1467214672{
    1467314673    detResidImfileAnalysisRow *object;
     
    1468114681    object->class_id = psStringCopy(class_id);
    1468214682    object->recipe = psStringCopy(recipe);
     14683    object->uri = psStringCopy(uri);
     14684    object->b1_uri = psStringCopy(b1_uri);
     14685    object->b2_uri = psStringCopy(b2_uri);
    1468314686
    1468414687    return object;
     
    1469014693    psFree(object->class_id);
    1469114694    psFree(object->recipe);
     14695    psFree(object->uri);
     14696    psFree(object->b1_uri);
     14697    psFree(object->b2_uri);
    1469214698}
    1469314699
     
    1472814734        return false;
    1472914735    }
     14736    if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, "64")) {
     14737        psError(PS_ERR_UNKNOWN, false, "failed to add item uri");
     14738        psFree(md);
     14739        return false;
     14740    }
     14741    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "64")) {
     14742        psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri");
     14743        psFree(md);
     14744        return false;
     14745    }
     14746    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "64")) {
     14747        psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri");
     14748        psFree(md);
     14749        return false;
     14750    }
    1473014751
    1473114752    status = psDBCreateTable(dbh, DETRESIDIMFILEANALYSIS_TABLE_NAME, md);
     
    1474114762}
    1474214763
    14743 bool detResidImfileAnalysisInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *exp_id, const char *class_id, const char *recipe)
     14764bool detResidImfileAnalysisInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *exp_id, const char *class_id, const char *recipe, const char *uri, const char *b1_uri, const char *b2_uri)
    1474414765{
    1474514766    psMetadata      *md;
     
    1476914790    if (!psMetadataAddStr(md, PS_LIST_TAIL, "recipe", 0, NULL, recipe)) {
    1477014791        psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");
     14792        psFree(md);
     14793        return false;
     14794    }
     14795    if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, uri)) {
     14796        psError(PS_ERR_UNKNOWN, false, "failed to add item uri");
     14797        psFree(md);
     14798        return false;
     14799    }
     14800    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, b1_uri)) {
     14801        psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri");
     14802        psFree(md);
     14803        return false;
     14804    }
     14805    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, b2_uri)) {
     14806        psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri");
    1477114807        psFree(md);
    1477214808        return false;
     
    1479314829    return deleted;
    1479414830}
    14795 bool detResidImfileAnalysisPop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **exp_id, char **class_id, char **recipe)
     14831bool detResidImfileAnalysisPop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **exp_id, char **class_id, char **recipe, char **uri, char **b1_uri, char **b2_uri)
    1479614832{
    1479714833    psArray         *rowSet;
     
    1486714903        return false;
    1486814904    }
     14905    *uri = psMetadataLookupPtr(&status, row, "uri");
     14906    if (!status) {
     14907        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item uri");
     14908        psFree(row);
     14909        return false;
     14910    }
     14911    *b1_uri = psMetadataLookupPtr(&status, row, "b1_uri");
     14912    if (!status) {
     14913        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b1_uri");
     14914        psFree(row);
     14915        return false;
     14916    }
     14917    *b2_uri = psMetadataLookupPtr(&status, row, "b2_uri");
     14918    if (!status) {
     14919        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b2_uri");
     14920        psFree(row);
     14921        return false;
     14922    }
    1486914923
    1487014924    psFree(row);
     
    1487514929bool detResidImfileAnalysisInsertObject(psDB *dbh, detResidImfileAnalysisRow *object)
    1487614930{
    14877     return detResidImfileAnalysisInsert(dbh, object->det_id, object->iteration, object->exp_id, object->class_id, object->recipe);
     14931    return detResidImfileAnalysisInsert(dbh, object->det_id, object->iteration, object->exp_id, object->class_id, object->recipe, object->uri, object->b1_uri, object->b2_uri);
    1487814932}
    1487914933
     
    1488514939    char            class_id[256];
    1488614940    char            recipe[256];
    14887 
    14888     if (!detResidImfileAnalysisPop(dbh, &det_id, &iteration, (char **)&exp_id, (char **)&class_id, (char **)&recipe)) {
     14941    char            uri[256];
     14942    char            b1_uri[256];
     14943    char            b2_uri[256];
     14944
     14945    if (!detResidImfileAnalysisPop(dbh, &det_id, &iteration, (char **)&exp_id, (char **)&class_id, (char **)&recipe, (char **)&uri, (char **)&b1_uri, (char **)&b2_uri)) {
    1488914946        psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
    1489014947        return NULL;
    1489114948    }
    1489214949
    14893     return detResidImfileAnalysisRowAlloc(det_id, iteration, exp_id, class_id, recipe);
     14950    return detResidImfileAnalysisRowAlloc(det_id, iteration, exp_id, class_id, recipe, uri, b1_uri, b2_uri);
    1489414951}
    1489514952
     
    1501515072        return NULL;
    1501615073    }
     15074    if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, object->uri)) {
     15075        psError(PS_ERR_UNKNOWN, false, "failed to add item uri");
     15076        psFree(md);
     15077        return NULL;
     15078    }
     15079    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, object->b1_uri)) {
     15080        psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri");
     15081        psFree(md);
     15082        return NULL;
     15083    }
     15084    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, object->b2_uri)) {
     15085        psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri");
     15086        psFree(md);
     15087        return NULL;
     15088    }
    1501715089
    1501815090    return md;
     
    1502715099    char            *class_id;
    1502815100    char            *recipe;
     15101    char            *uri;
     15102    char            *b1_uri;
     15103    char            *b2_uri;
    1502915104
    1503015105    det_id = psMetadataLookupS32(&status, md, "det_id");
     
    1505315128        return false;
    1505415129    }
    15055 
    15056     return detResidImfileAnalysisRowAlloc(det_id, iteration, exp_id, class_id, recipe);
     15130    uri = psMetadataLookupPtr(&status, md, "uri");
     15131    if (!status) {
     15132        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item uri");
     15133        return false;
     15134    }
     15135    b1_uri = psMetadataLookupPtr(&status, md, "b1_uri");
     15136    if (!status) {
     15137        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b1_uri");
     15138        return false;
     15139    }
     15140    b2_uri = psMetadataLookupPtr(&status, md, "b2_uri");
     15141    if (!status) {
     15142        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b2_uri");
     15143        return false;
     15144    }
     15145
     15146    return detResidImfileAnalysisRowAlloc(det_id, iteration, exp_id, class_id, recipe, uri, b1_uri, b2_uri);
    1505715147}
    1505815148psArray *detResidImfileAnalysisSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
  • branches/jhoblitt/ippdb/src/ippdb.h

    r8122 r8148  
    59085908    char            *class_id;
    59095909    char            *recipe;
     5910    char            *uri;
     5911    char            *b1_uri;
     5912    char            *b2_uri;
    59105913} detResidImfileAnalysisRow;
    59115914
     
    59205923    const char      *exp_id,
    59215924    const char      *class_id,
    5922     const char      *recipe
     5925    const char      *recipe,
     5926    const char      *uri,
     5927    const char      *b1_uri,
     5928    const char      *b2_uri
    59235929);
    59245930
     
    59545960    const char      *exp_id,
    59555961    const char      *class_id,
    5956     const char      *recipe
     5962    const char      *recipe,
     5963    const char      *uri,
     5964    const char      *b1_uri,
     5965    const char      *b2_uri
    59575966);
    59585967
     
    59795988    char            **exp_id,
    59805989    char            **class_id,
    5981     char            **recipe
     5990    char            **recipe,
     5991    char            **uri,
     5992    char            **b1_uri,
     5993    char            **b2_uri
    59825994);
    59835995
  • branches/jhoblitt/ippdb/tests/alloc.c

    r8103 r8148  
    12071207        detResidImfileAnalysisRow *object;
    12081208
    1209         object = detResidImfileAnalysisRowAlloc(-32, -32, "a string", "a string", "a string"    );
     1209        object = detResidImfileAnalysisRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string"    );
    12101210
    12111211        if (!object) {
     
    12301230        }
    12311231        if (strncmp(object->recipe, "a string", MAX_STRING_LENGTH)) {
     1232            psFree(object);
     1233            exit(EXIT_FAILURE);
     1234        }
     1235        if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) {
     1236            psFree(object);
     1237            exit(EXIT_FAILURE);
     1238        }
     1239        if (strncmp(object->b1_uri, "a string", MAX_STRING_LENGTH)) {
     1240            psFree(object);
     1241            exit(EXIT_FAILURE);
     1242        }
     1243        if (strncmp(object->b2_uri, "a string", MAX_STRING_LENGTH)) {
    12321244            psFree(object);
    12331245            exit(EXIT_FAILURE);
  • branches/jhoblitt/ippdb/tests/insert.c

    r8094 r8148  
    448448        }
    449449
    450         if (!detResidImfileAnalysisInsert(dbh, -32, -32, "a string", "a string", "a string")) {
     450        if (!detResidImfileAnalysisInsert(dbh, -32, -32, "a string", "a string", "a string", "a string", "a string", "a string")) {
    451451            exit(EXIT_FAILURE);
    452452        }
  • branches/jhoblitt/ippdb/tests/insertobject.c

    r8094 r8148  
    652652        }
    653653
    654         object = detResidImfileAnalysisRowAlloc(-32, -32, "a string", "a string", "a string");
     654        object = detResidImfileAnalysisRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string");
    655655        if (!object) {
    656656            exit(EXIT_FAILURE);
  • branches/jhoblitt/ippdb/tests/metadatafromobject.c

    r8103 r8148  
    14421442        bool            status;
    14431443
    1444         object = detResidImfileAnalysisRowAlloc(-32, -32, "a string", "a string", "a string");
     1444        object = detResidImfileAnalysisRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string");
    14451445        if (!object) {
    14461446            exit(EXIT_FAILURE);
     
    14711471        }
    14721472        if (strncmp(psMetadataLookupPtr(&status, md, "recipe"), "a string", MAX_STRING_LENGTH)) {
     1473            psFree(md);
     1474            exit(EXIT_FAILURE);
     1475        }
     1476        if (strncmp(psMetadataLookupPtr(&status, md, "uri"), "a string", MAX_STRING_LENGTH)) {
     1477            psFree(md);
     1478            exit(EXIT_FAILURE);
     1479        }
     1480        if (strncmp(psMetadataLookupPtr(&status, md, "b1_uri"), "a string", MAX_STRING_LENGTH)) {
     1481            psFree(md);
     1482            exit(EXIT_FAILURE);
     1483        }
     1484        if (strncmp(psMetadataLookupPtr(&status, md, "b2_uri"), "a string", MAX_STRING_LENGTH)) {
    14731485            psFree(md);
    14741486            exit(EXIT_FAILURE);
  • branches/jhoblitt/ippdb/tests/objectfrommetadata.c

    r8103 r8148  
    21952195            exit(EXIT_FAILURE);
    21962196        }
     2197        if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, "a string")) {
     2198            psFree(md);
     2199            exit(EXIT_FAILURE);
     2200        }
     2201        if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "a string")) {
     2202            psFree(md);
     2203            exit(EXIT_FAILURE);
     2204        }
     2205        if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "a string")) {
     2206            psFree(md);
     2207            exit(EXIT_FAILURE);
     2208        }
    21972209
    21982210        object = detResidImfileAnalysisObjectFromMetadata(md);
     
    22212233        }
    22222234        if (strncmp(object->recipe, "a string", MAX_STRING_LENGTH)) {
     2235            psFree(object);
     2236            exit(EXIT_FAILURE);
     2237        }
     2238        if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) {
     2239            psFree(object);
     2240            exit(EXIT_FAILURE);
     2241        }
     2242        if (strncmp(object->b1_uri, "a string", MAX_STRING_LENGTH)) {
     2243            psFree(object);
     2244            exit(EXIT_FAILURE);
     2245        }
     2246        if (strncmp(object->b2_uri, "a string", MAX_STRING_LENGTH)) {
    22232247            psFree(object);
    22242248            exit(EXIT_FAILURE);
  • branches/jhoblitt/ippdb/tests/pop.c

    r8103 r8148  
    652652        char            class_id[256];
    653653        char            recipe[256];
    654 
    655         dbh = psDBInit("localhost", "test", NULL, "test");
    656         if (!dbh) {
    657             exit(EXIT_FAILURE);
    658         }
    659 
    660         if (!detResidImfileAnalysisPop(dbh, &det_id, &iteration, (char **)&exp_id, (char **)&class_id, (char **)&recipe)) {
     654        char            uri[256];
     655        char            b1_uri[256];
     656        char            b2_uri[256];
     657
     658        dbh = psDBInit("localhost", "test", NULL, "test");
     659        if (!dbh) {
     660            exit(EXIT_FAILURE);
     661        }
     662
     663        if (!detResidImfileAnalysisPop(dbh, &det_id, &iteration, (char **)&exp_id, (char **)&class_id, (char **)&recipe, (char **)&uri, (char **)&b1_uri, (char **)&b2_uri)) {
    661664            exit(EXIT_FAILURE);
    662665        }
Note: See TracChangeset for help on using the changeset viewer.