IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8020


Ignore:
Timestamp:
Jul 31, 2006, 3:44:47 PM (20 years ago)
Author:
jhoblitt
Message:

VERSION 0.0.4

Location:
branches/jhoblitt/ippdb
Files:
9 edited

Legend:

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

    r7460 r8020  
    11AC_PREREQ(2.59)
    22
    3 AC_INIT([ippdb], [0.0.1], [pan-starrs.ifa.hawaii.edu])
     3AC_INIT([ippdb], [0.0.4], [pan-starrs.ifa.hawaii.edu])
    44AC_CONFIG_SRCDIR([ippdb.pc.in])
    55
  • branches/jhoblitt/ippdb/src/ippdb.c

    r8006 r8020  
    46704670static void pzPendingImfileRowFree(pzPendingImfileRow *object);
    46714671
    4672 pzPendingImfileRow *pzPendingImfileRowAlloc(const char *exp_id, psS32 bytes, const char *md5sum, const char *class, const char *class_id, const char *uri)
     4672pzPendingImfileRow *pzPendingImfileRowAlloc(const char *exp_id, psS32 bytes, const char *md5sum, const char *class_id, const char *uri)
    46734673{
    46744674    pzPendingImfileRow *object;
     
    46804680    object->bytes = bytes;
    46814681    object->md5sum = psStringCopy(md5sum);
    4682     object->class = psStringCopy(class);
    46834682    object->class_id = psStringCopy(class_id);
    46844683    object->uri = psStringCopy(uri);
     
    46914690    psFree(object->exp_id);
    46924691    psFree(object->md5sum);
    4693     psFree(object->class);
    46944692    psFree(object->class_id);
    46954693    psFree(object->uri);
     
    47224720        return false;
    47234721    }
    4724     if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "64")) {
    4725         psError(PS_ERR_UNKNOWN, false, "failed to add item class");
    4726         psFree(md);
    4727         return false;
    4728     }
    47294722    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class_id", 0, NULL, "64")) {
    47304723        psError(PS_ERR_UNKNOWN, false, "failed to add item class_id");
     
    47504743}
    47514744
    4752 bool pzPendingImfileInsert(psDB * dbh, const char *exp_id, psS32 bytes, const char *md5sum, const char *class, const char *class_id, const char *uri)
     4745bool pzPendingImfileInsert(psDB * dbh, const char *exp_id, psS32 bytes, const char *md5sum, const char *class_id, const char *uri)
    47534746{
    47544747    psMetadata      *md;
     
    47714764        return false;
    47724765    }
    4773     if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) {
    4774         psError(PS_ERR_UNKNOWN, false, "failed to add item class");
    4775         psFree(md);
    4776         return false;
    4777     }
    47784766    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class_id", 0, NULL, class_id)) {
    47794767        psError(PS_ERR_UNKNOWN, false, "failed to add item class_id");
     
    47934781}
    47944782
    4795 bool pzPendingImfilePop(psDB *dbh, char **exp_id, psS32 *bytes, char **md5sum, char **class, char **class_id, char **uri)
     4783bool pzPendingImfilePop(psDB *dbh, char **exp_id, psS32 *bytes, char **md5sum, char **class_id, char **uri)
    47964784{
    47974785    psArray         *rowSet;
     
    48554843        return false;
    48564844    }
    4857     *class = psMetadataLookupPtr(&status, row, "class");
    4858     if (!status) {
    4859         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
    4860         psFree(row);
    4861         return false;
    4862     }
    48634845    *class_id = psMetadataLookupPtr(&status, row, "class_id");
    48644846    if (!status) {
     
    48814863bool pzPendingImfileInsertObject(psDB *dbh, pzPendingImfileRow *object)
    48824864{
    4883     return pzPendingImfileInsert(dbh, object->exp_id, object->bytes, object->md5sum, object->class, object->class_id, object->uri);
     4865    return pzPendingImfileInsert(dbh, object->exp_id, object->bytes, object->md5sum, object->class_id, object->uri);
    48844866}
    48854867
     
    48894871    psS32           bytes;
    48904872    char            md5sum[256];
    4891     char            class[256];
    48924873    char            class_id[256];
    48934874    char            uri[256];
    48944875
    4895     if (!pzPendingImfilePop(dbh, (char **)&exp_id, &bytes, (char **)&md5sum, (char **)&class, (char **)&class_id, (char **)&uri)) {
     4876    if (!pzPendingImfilePop(dbh, (char **)&exp_id, &bytes, (char **)&md5sum, (char **)&class_id, (char **)&uri)) {
    48964877        psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
    48974878        return NULL;
    48984879    }
    48994880
    4900     return pzPendingImfileRowAlloc(exp_id, bytes, md5sum, class, class_id, uri);
     4881    return pzPendingImfileRowAlloc(exp_id, bytes, md5sum, class_id, uri);
    49014882}
    49024883
     
    50124993        return NULL;
    50134994    }
    5014     if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) {
    5015         psError(PS_ERR_UNKNOWN, false, "failed to add item class");
    5016         psFree(md);
    5017         return NULL;
    5018     }
    50194995    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class_id", 0, NULL, object->class_id)) {
    50204996        psError(PS_ERR_UNKNOWN, false, "failed to add item class_id");
     
    50375013    psS32           bytes;
    50385014    char            *md5sum;
    5039     char            *class;
    50405015    char            *class_id;
    50415016    char            *uri;
     
    50565031        return false;
    50575032    }
    5058     class = psMetadataLookupPtr(&status, md, "class");
    5059     if (!status) {
    5060         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
    5061         return false;
    5062     }
    50635033    class_id = psMetadataLookupPtr(&status, md, "class_id");
    50645034    if (!status) {
     
    50725042    }
    50735043
    5074     return pzPendingImfileRowAlloc(exp_id, bytes, md5sum, class, class_id, uri);
     5044    return pzPendingImfileRowAlloc(exp_id, bytes, md5sum, class_id, uri);
    50755045}
    50765046psArray *pzPendingImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     
    55605530static void newImfileRowFree(newImfileRow *object);
    55615531
    5562 newImfileRow *newImfileRowAlloc(const char *exp_id, const char *class, const char *class_id, const char *uri)
     5532newImfileRow *newImfileRowAlloc(const char *exp_id, const char *class_id, const char *uri)
    55635533{
    55645534    newImfileRow    *object;
     
    55685538
    55695539    object->exp_id = psStringCopy(exp_id);
    5570     object->class = psStringCopy(class);
    55715540    object->class_id = psStringCopy(class_id);
    55725541    object->uri = psStringCopy(uri);
     
    55785547{
    55795548    psFree(object->exp_id);
    5580     psFree(object->class);
    55815549    psFree(object->class_id);
    55825550    psFree(object->uri);
     
    55995567        return false;
    56005568    }
    5601     if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "64")) {
    5602         psError(PS_ERR_UNKNOWN, false, "failed to add item class");
    5603         psFree(md);
    5604         return false;
    5605     }
    56065569    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class_id", 0, NULL, "64")) {
    56075570        psError(PS_ERR_UNKNOWN, false, "failed to add item class_id");
     
    56275590}
    56285591
    5629 bool newImfileInsert(psDB * dbh, const char *exp_id, const char *class, const char *class_id, const char *uri)
     5592bool newImfileInsert(psDB * dbh, const char *exp_id, const char *class_id, const char *uri)
    56305593{
    56315594    psMetadata      *md;
     
    56385601        return false;
    56395602    }
    5640     if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) {
    5641         psError(PS_ERR_UNKNOWN, false, "failed to add item class");
    5642         psFree(md);
    5643         return false;
    5644     }
    56455603    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class_id", 0, NULL, class_id)) {
    56465604        psError(PS_ERR_UNKNOWN, false, "failed to add item class_id");
     
    56605618}
    56615619
    5662 bool newImfilePop(psDB *dbh, char **exp_id, char **class, char **class_id, char **uri)
     5620bool newImfilePop(psDB *dbh, char **exp_id, char **class_id, char **uri)
    56635621{
    56645622    psArray         *rowSet;
     
    57105668        return false;
    57115669    }
    5712     *class = psMetadataLookupPtr(&status, row, "class");
    5713     if (!status) {
    5714         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
    5715         psFree(row);
    5716         return false;
    5717     }
    57185670    *class_id = psMetadataLookupPtr(&status, row, "class_id");
    57195671    if (!status) {
     
    57365688bool newImfileInsertObject(psDB *dbh, newImfileRow *object)
    57375689{
    5738     return newImfileInsert(dbh, object->exp_id, object->class, object->class_id, object->uri);
     5690    return newImfileInsert(dbh, object->exp_id, object->class_id, object->uri);
    57395691}
    57405692
     
    57425694{
    57435695    char            exp_id[256];
    5744     char            class[256];
    57455696    char            class_id[256];
    57465697    char            uri[256];
    57475698
    5748     if (!newImfilePop(dbh, (char **)&exp_id, (char **)&class, (char **)&class_id, (char **)&uri)) {
     5699    if (!newImfilePop(dbh, (char **)&exp_id, (char **)&class_id, (char **)&uri)) {
    57495700        psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
    57505701        return NULL;
    57515702    }
    57525703
    5753     return newImfileRowAlloc(exp_id, class, class_id, uri);
     5704    return newImfileRowAlloc(exp_id, class_id, uri);
    57545705}
    57555706
     
    58555806        return NULL;
    58565807    }
    5857     if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) {
    5858         psError(PS_ERR_UNKNOWN, false, "failed to add item class");
    5859         psFree(md);
    5860         return NULL;
    5861     }
    58625808    if (!psMetadataAddStr(md, PS_LIST_TAIL, "class_id", 0, NULL, object->class_id)) {
    58635809        psError(PS_ERR_UNKNOWN, false, "failed to add item class_id");
     
    58785824    bool            status;
    58795825    char            *exp_id;
    5880     char            *class;
    58815826    char            *class_id;
    58825827    char            *uri;
     
    58875832        return false;
    58885833    }
    5889     class = psMetadataLookupPtr(&status, md, "class");
    5890     if (!status) {
    5891         psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");
    5892         return false;
    5893     }
    58945834    class_id = psMetadataLookupPtr(&status, md, "class_id");
    58955835    if (!status) {
     
    59035843    }
    59045844
    5905     return newImfileRowAlloc(exp_id, class, class_id, uri);
     5845    return newImfileRowAlloc(exp_id, class_id, uri);
    59065846}
    59075847psArray *newImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
  • branches/jhoblitt/ippdb/src/ippdb.h

    r8006 r8020  
    19141914    psS32           bytes;
    19151915    char            *md5sum;
    1916     char            *class;
    19171916    char            *class_id;
    19181917    char            *uri;
     
    19281927    psS32           bytes,
    19291928    const char      *md5sum,
    1930     const char      *class,
    19311929    const char      *class_id,
    19321930    const char      *uri
     
    19631961    psS32           bytes,
    19641962    const char      *md5sum,
    1965     const char      *class,
    19661963    const char      *class_id,
    19671964    const char      *uri
     
    19781975    psS32           *bytes,
    19791976    char            **md5sum,
    1980     char            **class,
    19811977    char            **class_id,
    19821978    char            **uri
     
    22822278typedef struct {
    22832279    char            *exp_id;
    2284     char            *class;
    22852280    char            *class_id;
    22862281    char            *uri;
     
    22942289newImfileRow *newImfileRowAlloc(
    22952290    const char      *exp_id,
    2296     const char      *class,
    22972291    const char      *class_id,
    22982292    const char      *uri
     
    23272321    psDB            *dbh,               ///< Database handle
    23282322    const char      *exp_id,
    2329     const char      *class,
    23302323    const char      *class_id,
    23312324    const char      *uri
     
    23402333    psDB            *dbh,               ///< Database handle
    23412334    char            **exp_id,
    2342     char            **class,
    23432335    char            **class_id,
    23442336    char            **uri
  • branches/jhoblitt/ippdb/tests/alloc.c

    r8006 r8020  
    384384        pzPendingImfileRow *object;
    385385
    386         object = pzPendingImfileRowAlloc("a string", -32, "a string", "a string", "a string", "a string"    );
     386        object = pzPendingImfileRowAlloc("a string", -32, "a string", "a string", "a string"    );
    387387
    388388        if (!object) {
     
    402402            exit(EXIT_FAILURE);
    403403        }
    404         if (strncmp(object->class, "a string", MAX_STRING_LENGTH)) {
    405             psFree(object);
    406             exit(EXIT_FAILURE);
    407         }
    408404        if (strncmp(object->class_id, "a string", MAX_STRING_LENGTH)) {
    409405            psFree(object);
     
    454450        newImfileRow    *object;
    455451
    456         object = newImfileRowAlloc("a string", "a string", "a string", "a string"    );
    457 
    458         if (!object) {
    459             exit(EXIT_FAILURE);
    460         }
    461 
    462         if (strncmp(object->exp_id, "a string", MAX_STRING_LENGTH)) {
    463             psFree(object);
    464             exit(EXIT_FAILURE);
    465         }
    466         if (strncmp(object->class, "a string", MAX_STRING_LENGTH)) {
     452        object = newImfileRowAlloc("a string", "a string", "a string"    );
     453
     454        if (!object) {
     455            exit(EXIT_FAILURE);
     456        }
     457
     458        if (strncmp(object->exp_id, "a string", MAX_STRING_LENGTH)) {
    467459            psFree(object);
    468460            exit(EXIT_FAILURE);
  • branches/jhoblitt/ippdb/tests/insert.c

    r8006 r8020  
    163163        }
    164164
    165         if (!pzPendingImfileInsert(dbh, "a string", -32, "a string", "a string", "a string", "a string")) {
     165        if (!pzPendingImfileInsert(dbh, "a string", -32, "a string", "a string", "a string")) {
    166166            exit(EXIT_FAILURE);
    167167        }
     
    193193        }
    194194
    195         if (!newImfileInsert(dbh, "a string", "a string", "a string", "a string")) {
     195        if (!newImfileInsert(dbh, "a string", "a string", "a string")) {
    196196            exit(EXIT_FAILURE);
    197197        }
  • branches/jhoblitt/ippdb/tests/insertobject.c

    r8006 r8020  
    234234        }
    235235
    236         object = pzPendingImfileRowAlloc("a string", -32, "a string", "a string", "a string", "a string");
     236        object = pzPendingImfileRowAlloc("a string", -32, "a string", "a string", "a string");
    237237        if (!object) {
    238238            exit(EXIT_FAILURE);
     
    278278        }
    279279
    280         object = newImfileRowAlloc("a string", "a string", "a string", "a string");
     280        object = newImfileRowAlloc("a string", "a string", "a string");
    281281        if (!object) {
    282282            exit(EXIT_FAILURE);
  • branches/jhoblitt/ippdb/tests/metadatafromobject.c

    r8006 r8020  
    467467        bool            status;
    468468
    469         object = pzPendingImfileRowAlloc("a string", -32, "a string", "a string", "a string", "a string");
     469        object = pzPendingImfileRowAlloc("a string", -32, "a string", "a string", "a string");
    470470        if (!object) {
    471471            exit(EXIT_FAILURE);
     
    491491            exit(EXIT_FAILURE);
    492492        }
    493         if (strncmp(psMetadataLookupPtr(&status, md, "class"), "a string", MAX_STRING_LENGTH)) {
    494             psFree(md);
    495             exit(EXIT_FAILURE);
    496         }
    497493        if (strncmp(psMetadataLookupPtr(&status, md, "class_id"), "a string", MAX_STRING_LENGTH)) {
    498494            psFree(md);
     
    553549        bool            status;
    554550
    555         object = newImfileRowAlloc("a string", "a string", "a string", "a string");
     551        object = newImfileRowAlloc("a string", "a string", "a string");
    556552        if (!object) {
    557553            exit(EXIT_FAILURE);
     
    566562
    567563        if (strncmp(psMetadataLookupPtr(&status, md, "exp_id"), "a string", MAX_STRING_LENGTH)) {
    568             psFree(md);
    569             exit(EXIT_FAILURE);
    570         }
    571         if (strncmp(psMetadataLookupPtr(&status, md, "class"), "a string", MAX_STRING_LENGTH)) {
    572564            psFree(md);
    573565            exit(EXIT_FAILURE);
  • branches/jhoblitt/ippdb/tests/objectfrommetadata.c

    r8006 r8020  
    693693            exit(EXIT_FAILURE);
    694694        }
    695         if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "a string")) {
    696             psFree(md);
    697             exit(EXIT_FAILURE);
    698         }
    699695        if (!psMetadataAddStr(md, PS_LIST_TAIL, "class_id", 0, NULL, "a string")) {
    700696            psFree(md);
     
    726722            exit(EXIT_FAILURE);
    727723        }
    728         if (strncmp(object->class, "a string", MAX_STRING_LENGTH)) {
    729             psFree(object);
    730             exit(EXIT_FAILURE);
    731         }
    732724        if (strncmp(object->class_id, "a string", MAX_STRING_LENGTH)) {
    733725            psFree(object);
     
    809801            exit(EXIT_FAILURE);
    810802        }
    811         if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "a string")) {
    812             psFree(md);
    813             exit(EXIT_FAILURE);
    814         }
    815803        if (!psMetadataAddStr(md, PS_LIST_TAIL, "class_id", 0, NULL, "a string")) {
    816804            psFree(md);
     
    831819
    832820        if (strncmp(object->exp_id, "a string", MAX_STRING_LENGTH)) {
    833             psFree(object);
    834             exit(EXIT_FAILURE);
    835         }
    836         if (strncmp(object->class, "a string", MAX_STRING_LENGTH)) {
    837821            psFree(object);
    838822            exit(EXIT_FAILURE);
  • branches/jhoblitt/ippdb/tests/pop.c

    r8006 r8020  
    221221        psS32           bytes;
    222222        char            md5sum[256];
    223         char            class[256];
    224         char            class_id[256];
    225         char            uri[256];
    226 
    227         dbh = psDBInit("localhost", "test", NULL, "test");
    228         if (!dbh) {
    229             exit(EXIT_FAILURE);
    230         }
    231 
    232         if (!pzPendingImfilePop(dbh, (char **)&exp_id, &bytes, (char **)&md5sum, (char **)&class, (char **)&class_id, (char **)&uri)) {
     223        char            class_id[256];
     224        char            uri[256];
     225
     226        dbh = psDBInit("localhost", "test", NULL, "test");
     227        if (!dbh) {
     228            exit(EXIT_FAILURE);
     229        }
     230
     231        if (!pzPendingImfilePop(dbh, (char **)&exp_id, &bytes, (char **)&md5sum, (char **)&class_id, (char **)&uri)) {
    233232            exit(EXIT_FAILURE);
    234233        }
     
    260259        psDB            *dbh;
    261260        char            exp_id[256];
    262         char            class[256];
    263         char            class_id[256];
    264         char            uri[256];
    265 
    266         dbh = psDBInit("localhost", "test", NULL, "test");
    267         if (!dbh) {
    268             exit(EXIT_FAILURE);
    269         }
    270 
    271         if (!newImfilePop(dbh, (char **)&exp_id, (char **)&class, (char **)&class_id, (char **)&uri)) {
     261        char            class_id[256];
     262        char            uri[256];
     263
     264        dbh = psDBInit("localhost", "test", NULL, "test");
     265        if (!dbh) {
     266            exit(EXIT_FAILURE);
     267        }
     268
     269        if (!newImfilePop(dbh, (char **)&exp_id, (char **)&class_id, (char **)&uri)) {
    272270            exit(EXIT_FAILURE);
    273271        }
Note: See TracChangeset for help on using the changeset viewer.