IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 19, 2006, 4:16:26 PM (21 years ago)
Author:
jhoblitt
Message:

compilation fixes
switch to using the metadatadb API

File:
1 edited

Legend:

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

    r6032 r6060  
     1#include <metadatadb.h>
    12# include "p2search.h"
    23
     
    45// NOTE this function converts the rawFrames to pendingFrames AND inserts them
    56//      this is useful since the table must be locked the whole time, to get the versions
    6 bool p2insertPendingFrames (p2SearchConfig *config, psArray *rawFrames) {
     7bool p2insertPendingFrames (p2Config *config, psArray *rawFrames) {
    78
    89    psMetadata *where = psMetadataAlloc ();
     
    1213
    1314        // find the next available version numbers
    14         psMetadataAddStr (where, PS_LIST_TAIL, "EXP_ID", PS_META_REPLACE, "==", rawFrame->exposure->expID);
    15         psArray *exposures = p2PendingExposureSelectRows (config->database, where, MAX_ROWS);
     15        psMetadataAddStr (where, PS_LIST_TAIL, "EXP_ID", PS_META_REPLACE, "==", rawFrame->exposure->exp_id);
     16        psArray *exposures = p2PendingExpSelectRowObjects(config->database, where, MAX_ROWS);
    1617        int version = -1;
    1718        for (int j = 0; j < exposures->n; j++) {
    18             p2PendingExposure *exposure = exposures->data[j];
    19             version = PS_MAX (version, exposure->P2version);
     19            p2PendingExpRow *exposure = exposures->data[j];
     20            version = PS_MAX (version, exposure->p2_version);
    2021        }
    2122        version ++;
    2223
    23         p2PendingExposureRow *pendingExposure = p2PendingExposureAlloc ();
    24         strcpy (pendingExposure->expID, rawFrame->exposure->expID);
    25         pendingExposure->class = rawFrame->exposure->class;
    26         pendingExposure->Nclass = rawFrame->exposure->Nclass;
    27         pendingExposure->Ndone = 0;
    28         pendingExposure->P1version = 0xff;
    29         pendingExposure->P2version = version;
    30         pendingExposure->state = P2_STATE_PENDING;
     24        p2PendingExpRow *pendingExposure = p2PendingExpRowAlloc(
     25        rawFrame->exposure->exp_id,
     26        rawFrame->exposure->class,
     27        rawFrame->exposure->nclass,
     28        0xff,
     29        version
     30        // pendingExposure->Ndone = 0;
     31        // pendingExposure->state = P2_STATE_PENDING;
     32    );
    3133
    3234        psArray *pendingImages = psArrayAlloc (rawFrame->images->n);
    3335        pendingImages->n = 0;
    3436        for (int j = 0; j < rawFrame->images->n; j++) {
    35             ppRawImage *rawImage = rawFrame->images->data[j];
    36             p2PendingImage *pendingImage = p2PendingImageAlloc ();
    37 
    38             strcpy (pendingImage->expID, rawImage->expID);
    39             pendingImage->P2version = version;
    40             pendingImage->class = rawImage->class;
    41             strcpy (pendingImage->classID, rawImage->classID);
    42 
    43             // XXX cleanup the url somehow
    44             strcpy (pendingImage->urlroot = rawImage->url);
    45             strcpy (pendingImage->input, "raw.fits");
    46             strcpy (pendingImage->output, "flt.fits");
    47             strcpy (pendingImage->log, "log");
    48             strcpy (pendingImage->smf, "smf");
    49             pendingImage->state = P2_STATE_PENDING;
     37            rawImfileRow *rawImage = rawFrame->images->data[j];
     38            p2PendingImfileRow *pendingImage = p2PendingImfileRowAlloc(
     39                rawImage->exp_id,
     40                rawImage->class,
     41                rawImage->class_id,
     42                version, // p1
     43                version, // p2
     44            "",
     45            "",
     46                // XXX cleanup the url somehow
     47                rawImage->url
     48        );
    5049
    5150            psArrayAdd (pendingImages, 100, pendingImage);
    5251        }
    5352       
    54         p2PendingExposureInsertObject (config->database, pendingExposure);
    55         p2PendingImageInsertObjects (config->database, pendingImages);
     53        p2PendingExpInsertObject (config->database, pendingExposure);
     54
     55    for (int i = 0; i < pendingImages->n; i++) {
     56            p2PendingImfileInsertObject(config->database, pendingImages->data[i]);
     57    }
     58
    5659    }
    5760    return true;
Note: See TracChangeset for help on using the changeset viewer.