IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9213 for trunk/ippdb


Ignore:
Timestamp:
Oct 4, 2006, 11:22:25 AM (20 years ago)
Author:
jhoblitt
Message:

VERSION 0.0.44

Location:
trunk/ippdb
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippdb/configure.ac

    r9187 r9213  
    77AC_PREREQ(2.59)
    88
    9 AC_INIT([ippdb], [0.0.43], [pan-starrs.ifa.hawaii.edu])
     9AC_INIT([ippdb], [0.0.44], [pan-starrs.ifa.hawaii.edu])
    1010AC_CONFIG_SRCDIR([ippdb.pc.in])
    1111
  • trunk/ippdb/src/ippdb.c

    r9187 r9213  
    1181511815        return false;
    1181611816    }
    11817     if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "64")) {
     11817    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "255")) {
    1181811818        psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri");
    1181911819        psFree(md);
    1182011820        return false;
    1182111821    }
    11822     if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "64")) {
     11822    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "255")) {
    1182311823        psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri");
    1182411824        psFree(md);
     
    1385813858        return false;
    1385913859    }
    13860     if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "64")) {
     13860    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "255")) {
    1386113861        psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri");
    1386213862        psFree(md);
    1386313863        return false;
    1386413864    }
    13865     if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "64")) {
     13865    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "255")) {
    1386613866        psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri");
    1386713867        psFree(md);
     
    1449514495        return false;
    1449614496    }
    14497     if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "64")) {
     14497    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "255")) {
    1449814498        psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri");
    1449914499        psFree(md);
    1450014500        return false;
    1450114501    }
    14502     if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "64")) {
     14502    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "255")) {
    1450314503        psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri");
    1450414504        psFree(md);
     
    1608016080static void detNormalizedImfileRowFree(detNormalizedImfileRow *object);
    1608116081
    16082 detNormalizedImfileRow *detNormalizedImfileRowAlloc(psS32 det_id, psS32 iteration, const char *class_id, const char *uri)
     16082detNormalizedImfileRow *detNormalizedImfileRowAlloc(psS32 det_id, psS32 iteration, const char *class_id, const char *uri, const char *b1_uri, const char *b2_uri)
    1608316083{
    1608416084    detNormalizedImfileRow *object;
     
    1609116091    object->class_id = psStringCopy(class_id);
    1609216092    object->uri = psStringCopy(uri);
     16093    object->b1_uri = psStringCopy(b1_uri);
     16094    object->b2_uri = psStringCopy(b2_uri);
    1609316095
    1609416096    return object;
     
    1609916101    psFree(object->class_id);
    1610016102    psFree(object->uri);
     16103    psFree(object->b1_uri);
     16104    psFree(object->b2_uri);
    1610116105}
    1610216106
     
    1613216136        return false;
    1613316137    }
     16138    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "255")) {
     16139        psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri");
     16140        psFree(md);
     16141        return false;
     16142    }
     16143    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "255")) {
     16144        psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri");
     16145        psFree(md);
     16146        return false;
     16147    }
    1613416148
    1613516149    status = psDBCreateTable(dbh, DETNORMALIZEDIMFILE_TABLE_NAME, md);
     
    1614516159}
    1614616160
    16147 bool detNormalizedImfileInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *class_id, const char *uri)
     16161bool detNormalizedImfileInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *class_id, const char *uri, const char *b1_uri, const char *b2_uri)
    1614816162{
    1614916163    psMetadata      *md;
     
    1616816182    if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, uri)) {
    1616916183        psError(PS_ERR_UNKNOWN, false, "failed to add item uri");
     16184        psFree(md);
     16185        return false;
     16186    }
     16187    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, b1_uri)) {
     16188        psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri");
     16189        psFree(md);
     16190        return false;
     16191    }
     16192    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, b2_uri)) {
     16193        psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri");
    1617016194        psFree(md);
    1617116195        return false;
     
    1619216216    return deleted;
    1619316217}
    16194 bool detNormalizedImfilePop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **class_id, char **uri)
     16218bool detNormalizedImfilePop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **class_id, char **uri, char **b1_uri, char **b2_uri)
    1619516219{
    1619616220    psArray         *rowSet;
     
    1626016284        return false;
    1626116285    }
     16286    *b1_uri = psMetadataLookupPtr(&status, row, "b1_uri");
     16287    if (!status) {
     16288        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b1_uri");
     16289        psFree(row);
     16290        return false;
     16291    }
     16292    *b2_uri = psMetadataLookupPtr(&status, row, "b2_uri");
     16293    if (!status) {
     16294        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b2_uri");
     16295        psFree(row);
     16296        return false;
     16297    }
    1626216298
    1626316299    psFree(row);
     
    1626816304bool detNormalizedImfileInsertObject(psDB *dbh, detNormalizedImfileRow *object)
    1626916305{
    16270     return detNormalizedImfileInsert(dbh, object->det_id, object->iteration, object->class_id, object->uri);
     16306    return detNormalizedImfileInsert(dbh, object->det_id, object->iteration, object->class_id, object->uri, object->b1_uri, object->b2_uri);
    1627116307}
    1627216308
     
    1628816324    char            class_id[256];
    1628916325    char            uri[256];
    16290 
    16291     if (!detNormalizedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri)) {
     16326    char            b1_uri[256];
     16327    char            b2_uri[256];
     16328
     16329    if (!detNormalizedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri, (char **)&b1_uri, (char **)&b2_uri)) {
    1629216330        psError(PS_ERR_UNKNOWN, false, "failed to pop a database row");
    1629316331        return NULL;
    1629416332    }
    1629516333
    16296     return detNormalizedImfileRowAlloc(det_id, iteration, class_id, uri);
     16334    return detNormalizedImfileRowAlloc(det_id, iteration, class_id, uri, b1_uri, b2_uri);
    1629716335}
    1629816336
     
    1641316451        return NULL;
    1641416452    }
     16453    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, object->b1_uri)) {
     16454        psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri");
     16455        psFree(md);
     16456        return NULL;
     16457    }
     16458    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, object->b2_uri)) {
     16459        psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri");
     16460        psFree(md);
     16461        return NULL;
     16462    }
    1641516463
    1641616464    return md;
     
    1642416472    char            *class_id;
    1642516473    char            *uri;
     16474    char            *b1_uri;
     16475    char            *b2_uri;
    1642616476
    1642716477    det_id = psMetadataLookupS32(&status, md, "det_id");
     
    1644516495        return false;
    1644616496    }
    16447 
    16448     return detNormalizedImfileRowAlloc(det_id, iteration, class_id, uri);
     16497    b1_uri = psMetadataLookupPtr(&status, md, "b1_uri");
     16498    if (!status) {
     16499        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b1_uri");
     16500        return false;
     16501    }
     16502    b2_uri = psMetadataLookupPtr(&status, md, "b2_uri");
     16503    if (!status) {
     16504        psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b2_uri");
     16505        return false;
     16506    }
     16507
     16508    return detNormalizedImfileRowAlloc(det_id, iteration, class_id, uri, b1_uri, b2_uri);
    1644916509}
    1645016510psArray *detNormalizedImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
     
    1662016680        return false;
    1662116681    }
    16622     if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "64")) {
     16682    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "255")) {
    1662316683        psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri");
    1662416684        psFree(md);
    1662516685        return false;
    1662616686    }
    16627     if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "64")) {
     16687    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "255")) {
    1662816688        psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri");
    1662916689        psFree(md);
     
    1812318183        return false;
    1812418184    }
    18125     if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, "64")) {
     18185    if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, "255")) {
    1812618186        psError(PS_ERR_UNKNOWN, false, "failed to add item uri");
    1812718187        psFree(md);
     
    1814818208        return false;
    1814918209    }
    18150     if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "64")) {
     18210    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "255")) {
    1815118211        psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri");
    1815218212        psFree(md);
    1815318213        return false;
    1815418214    }
    18155     if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "64")) {
     18215    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "255")) {
    1815618216        psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri");
    1815718217        psFree(md);
     
    1881518875        return false;
    1881618876    }
    18817     if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "64")) {
     18877    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "255")) {
    1881818878        psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri");
    1881918879        psFree(md);
    1882018880        return false;
    1882118881    }
    18822     if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "64")) {
     18882    if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "255")) {
    1882318883        psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri");
    1882418884        psFree(md);
  • trunk/ippdb/src/ippdb.h

    r9187 r9213  
    68236823    char            *class_id;
    68246824    char            *uri;
     6825    char            *b1_uri;
     6826    char            *b2_uri;
    68256827} detNormalizedImfileRow;
    68266828
     
    68346836    psS32           iteration,
    68356837    const char      *class_id,
    6836     const char      *uri
     6838    const char      *uri,
     6839    const char      *b1_uri,
     6840    const char      *b2_uri
    68376841);
    68386842
     
    68676871    psS32           iteration,
    68686872    const char      *class_id,
    6869     const char      *uri
     6873    const char      *uri,
     6874    const char      *b1_uri,
     6875    const char      *b2_uri
    68706876);
    68716877
     
    68916897    psS32           *iteration,
    68926898    char            **class_id,
    6893     char            **uri
     6899    char            **uri,
     6900    char            **b1_uri,
     6901    char            **b2_uri
    68946902);
    68956903
  • trunk/ippdb/tests/alloc.c

    r9187 r9213  
    11751175        detNormalizedImfileRow *object;
    11761176
    1177         object = detNormalizedImfileRowAlloc(-32, -32, "a string", "a string"    );
     1177        object = detNormalizedImfileRowAlloc(-32, -32, "a string", "a string", "a string", "a string"    );
    11781178
    11791179        if (!object) {
     
    11941194        }
    11951195        if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) {
     1196            psFree(object);
     1197            exit(EXIT_FAILURE);
     1198        }
     1199        if (strncmp(object->b1_uri, "a string", MAX_STRING_LENGTH)) {
     1200            psFree(object);
     1201            exit(EXIT_FAILURE);
     1202        }
     1203        if (strncmp(object->b2_uri, "a string", MAX_STRING_LENGTH)) {
    11961204            psFree(object);
    11971205            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/insert.c

    r9187 r9213  
    433433        }
    434434
    435         if (!detNormalizedImfileInsert(dbh, -32, -32, "a string", "a string")) {
     435        if (!detNormalizedImfileInsert(dbh, -32, -32, "a string", "a string", "a string", "a string")) {
    436436            exit(EXIT_FAILURE);
    437437        }
  • trunk/ippdb/tests/insertobject.c

    r9187 r9213  
    630630        }
    631631
    632         object = detNormalizedImfileRowAlloc(-32, -32, "a string", "a string");
     632        object = detNormalizedImfileRowAlloc(-32, -32, "a string", "a string", "a string", "a string");
    633633        if (!object) {
    634634            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/metadatafromobject.c

    r9187 r9213  
    14011401        bool            status;
    14021402
    1403         object = detNormalizedImfileRowAlloc(-32, -32, "a string", "a string");
     1403        object = detNormalizedImfileRowAlloc(-32, -32, "a string", "a string", "a string", "a string");
    14041404        if (!object) {
    14051405            exit(EXIT_FAILURE);
     
    14261426        }
    14271427        if (strncmp(psMetadataLookupPtr(&status, md, "uri"), "a string", MAX_STRING_LENGTH)) {
     1428            psFree(md);
     1429            exit(EXIT_FAILURE);
     1430        }
     1431        if (strncmp(psMetadataLookupPtr(&status, md, "b1_uri"), "a string", MAX_STRING_LENGTH)) {
     1432            psFree(md);
     1433            exit(EXIT_FAILURE);
     1434        }
     1435        if (strncmp(psMetadataLookupPtr(&status, md, "b2_uri"), "a string", MAX_STRING_LENGTH)) {
    14281436            psFree(md);
    14291437            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/objectfrommetadata.c

    r9187 r9213  
    21332133            exit(EXIT_FAILURE);
    21342134        }
     2135        if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "a string")) {
     2136            psFree(md);
     2137            exit(EXIT_FAILURE);
     2138        }
     2139        if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "a string")) {
     2140            psFree(md);
     2141            exit(EXIT_FAILURE);
     2142        }
    21352143
    21362144        object = detNormalizedImfileObjectFromMetadata(md);
     
    21552163        }
    21562164        if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) {
     2165            psFree(object);
     2166            exit(EXIT_FAILURE);
     2167        }
     2168        if (strncmp(object->b1_uri, "a string", MAX_STRING_LENGTH)) {
     2169            psFree(object);
     2170            exit(EXIT_FAILURE);
     2171        }
     2172        if (strncmp(object->b2_uri, "a string", MAX_STRING_LENGTH)) {
    21572173            psFree(object);
    21582174            exit(EXIT_FAILURE);
  • trunk/ippdb/tests/pop.c

    r9187 r9213  
    631631        char            class_id[256];
    632632        char            uri[256];
    633 
    634         dbh = psDBInit("localhost", "test", NULL, "test");
    635         if (!dbh) {
    636             exit(EXIT_FAILURE);
    637         }
    638 
    639         if (!detNormalizedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri)) {
     633        char            b1_uri[256];
     634        char            b2_uri[256];
     635
     636        dbh = psDBInit("localhost", "test", NULL, "test");
     637        if (!dbh) {
     638            exit(EXIT_FAILURE);
     639        }
     640
     641        if (!detNormalizedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri, (char **)&b1_uri, (char **)&b2_uri)) {
    640642            exit(EXIT_FAILURE);
    641643        }
Note: See TracChangeset for help on using the changeset viewer.