IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 5, 2009, 9:35:41 AM (17 years ago)
Author:
bills
Message:

Changed the way image ids are handled. For chip and warp new tables are
added the sole purpose of which are to create the image ids before
the images are created. For diff the id is added to diffInputSkyfile

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/warptool.c

    r20973 r21308  
    681681{
    682682    unsigned int nFail = 0;
     683    psMetadata *imfiles = psMetadataAlloc();
    683684    psMetadata *skycells = psMetadataConfigRead(NULL, &nFail, mapfile, false);
    684685    if (!skycells) {
     
    689690        psError(PS_ERR_UNKNOWN, false, "there were %d errors parsing mapfile: %s", nFail, mapfile);
    690691        psFree(skycells);
     692        psFree(imfiles);
    691693        return false;
    692694    }
     
    699701            psFree(iter);
    700702            psFree(skycells);
     703            psFree(imfiles);
    701704            return false;
    702705        }
     
    710713            psFree(iter);
    711714            psFree(skycells);
    712             return false;
    713         }
     715            psFree(imfiles);
     716            return false;
     717        }
     718        psMetadataAddS64(imfiles, PS_LIST_TAIL, row->skycell_id, PS_META_REPLACE, "", row->warp_id);
    714719
    715720        if (!warpSkyCellMapInsertObject(config->dbh, row)) {
     
    726731            psFree(iter);
    727732            psFree(skycells);
     733            psFree(imfiles);
    728734            return false;
    729735        }
    730736
    731737        psFree(row);
     738    }
     739    psFree(iter);
     740
     741    // create warp_skyfile_ids for the output skyfiles
     742    psString query = "INSERT INTO warpImfile VALUES(%" PRId64 ", '%s', 0)";
     743    iter = psMetadataIteratorAlloc(imfiles, 0, NULL);
     744    while ((item = psMetadataGetAndIncrement(iter))) {
     745        psString skycell_id = item->name;
     746        psS64 warp_id = item->data.S64;
     747
     748        if (!p_psDBRunQuery(config->dbh, query, warp_id, skycell_id)) {
     749            psError(PS_ERR_UNKNOWN, false, "database error");
     750            return false;
     751        }
    732752    }
    733753    psFree(iter);
    734754    psFree(skycells);
     755    psFree(imfiles);
    735756
    736757    return true;
     
    940961                           !accept,
    941962                           code,
    942                            0,           // warp_image_id
    943963                           0            // magic_ds_id
    944964        )) {
Note: See TracChangeset for help on using the changeset viewer.