Changeset 6060 for trunk/ippTools/src/p2insertPendingFrames.c
- Timestamp:
- Jan 19, 2006, 4:16:26 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/p2insertPendingFrames.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/p2insertPendingFrames.c
r6032 r6060 1 #include <metadatadb.h> 1 2 # include "p2search.h" 2 3 … … 4 5 // NOTE this function converts the rawFrames to pendingFrames AND inserts them 5 6 // this is useful since the table must be locked the whole time, to get the versions 6 bool p2insertPendingFrames (p2 SearchConfig *config, psArray *rawFrames) {7 bool p2insertPendingFrames (p2Config *config, psArray *rawFrames) { 7 8 8 9 psMetadata *where = psMetadataAlloc (); … … 12 13 13 14 // find the next available version numbers 14 psMetadataAddStr (where, PS_LIST_TAIL, "EXP_ID", PS_META_REPLACE, "==", rawFrame->exposure->exp ID);15 psArray *exposures = p2PendingExp osureSelectRows(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); 16 17 int version = -1; 17 18 for (int j = 0; j < exposures->n; j++) { 18 p2PendingExp osure*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); 20 21 } 21 22 version ++; 22 23 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 ); 31 33 32 34 psArray *pendingImages = psArrayAlloc (rawFrame->images->n); 33 35 pendingImages->n = 0; 34 36 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 ); 50 49 51 50 psArrayAdd (pendingImages, 100, pendingImage); 52 51 } 53 52 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 56 59 } 57 60 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
