Changeset 8079 for branches/jhoblitt/ippdb/src/ippdb.c
- Timestamp:
- Aug 2, 2006, 2:47:23 PM (20 years ago)
- File:
-
- 1 edited
-
branches/jhoblitt/ippdb/src/ippdb.c (modified) (108 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/jhoblitt/ippdb/src/ippdb.c
r8054 r8079 5130 5130 static void newExpRowFree(newExpRow *object); 5131 5131 5132 newExpRow *newExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles )5132 newExpRow *newExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *class) 5133 5133 { 5134 5134 newExpRow *object; … … 5142 5142 object->exp_type = psStringCopy(exp_type); 5143 5143 object->imfiles = imfiles; 5144 object->class = psStringCopy(class); 5144 5145 5145 5146 return object; … … 5152 5153 psFree(object->telescope); 5153 5154 psFree(object->exp_type); 5155 psFree(object->class); 5154 5156 } 5155 5157 … … 5190 5192 return false; 5191 5193 } 5194 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "64")) { 5195 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 5196 psFree(md); 5197 return false; 5198 } 5192 5199 5193 5200 status = psDBCreateTable(dbh, NEWEXP_TABLE_NAME, md); … … 5203 5210 } 5204 5211 5205 bool newExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles )5212 bool newExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *class) 5206 5213 { 5207 5214 psMetadata *md; … … 5234 5241 return false; 5235 5242 } 5243 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) { 5244 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 5245 psFree(md); 5246 return false; 5247 } 5236 5248 5237 5249 status = psDBInsertOneRow(dbh, NEWEXP_TABLE_NAME, md); … … 5241 5253 } 5242 5254 5243 bool newExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles )5255 bool newExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **class) 5244 5256 { 5245 5257 psArray *rowSet; … … 5315 5327 return false; 5316 5328 } 5329 *class = psMetadataLookupPtr(&status, row, "class"); 5330 if (!status) { 5331 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class"); 5332 psFree(row); 5333 return false; 5334 } 5317 5335 5318 5336 psFree(row); … … 5323 5341 bool newExpInsertObject(psDB *dbh, newExpRow *object) 5324 5342 { 5325 return newExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles );5343 return newExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->class); 5326 5344 } 5327 5345 … … 5333 5351 char exp_type[256]; 5334 5352 psS32 imfiles; 5335 5336 if (!newExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles)) { 5353 char class[256]; 5354 5355 if (!newExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&class)) { 5337 5356 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 5338 5357 return NULL; 5339 5358 } 5340 5359 5341 return newExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles );5360 return newExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, class); 5342 5361 } 5343 5362 … … 5463 5482 return NULL; 5464 5483 } 5484 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) { 5485 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 5486 psFree(md); 5487 return NULL; 5488 } 5465 5489 5466 5490 return md; … … 5475 5499 char *exp_type; 5476 5500 psS32 imfiles; 5501 char *class; 5477 5502 5478 5503 exp_id = psMetadataLookupPtr(&status, md, "exp_id"); … … 5501 5526 return false; 5502 5527 } 5503 5504 return newExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles); 5528 class = psMetadataLookupPtr(&status, md, "class"); 5529 if (!status) { 5530 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class"); 5531 return false; 5532 } 5533 5534 return newExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, class); 5505 5535 } 5506 5536 psArray *newExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 5961 5991 static void rawDetrendExpRowFree(rawDetrendExpRow *object); 5962 5992 5963 rawDetrendExpRow *rawDetrendExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char * stats)5993 rawDetrendExpRow *rawDetrendExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time) 5964 5994 { 5965 5995 rawDetrendExpRow *object; … … 5974 6004 object->imfiles = imfiles; 5975 6005 object->filter = psStringCopy(filter); 5976 object->stats = psStringCopy(stats); 6006 object->class = psStringCopy(class); 6007 object->airmass = airmass; 6008 object->ra = ra; 6009 object->dec = dec; 6010 object->exp_time = exp_time; 5977 6011 5978 6012 return object; … … 5986 6020 psFree(object->exp_type); 5987 6021 psFree(object->filter); 5988 psFree(object-> stats);6022 psFree(object->class); 5989 6023 } 5990 6024 … … 6030 6064 return false; 6031 6065 } 6032 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, "255")) { 6033 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 6066 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "255")) { 6067 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 6068 psFree(md); 6069 return false; 6070 } 6071 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, 0.0)) { 6072 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 6073 psFree(md); 6074 return false; 6075 } 6076 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, 0.0)) { 6077 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 6078 psFree(md); 6079 return false; 6080 } 6081 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, 0.0)) { 6082 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 6083 psFree(md); 6084 return false; 6085 } 6086 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, 0.0)) { 6087 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 6034 6088 psFree(md); 6035 6089 return false; … … 6048 6102 } 6049 6103 6050 bool rawDetrendExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char * stats)6104 bool rawDetrendExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time) 6051 6105 { 6052 6106 psMetadata *md; … … 6084 6138 return false; 6085 6139 } 6086 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, stats)) { 6087 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 6140 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) { 6141 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 6142 psFree(md); 6143 return false; 6144 } 6145 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, airmass)) { 6146 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 6147 psFree(md); 6148 return false; 6149 } 6150 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, ra)) { 6151 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 6152 psFree(md); 6153 return false; 6154 } 6155 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, dec)) { 6156 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 6157 psFree(md); 6158 return false; 6159 } 6160 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, exp_time)) { 6161 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 6088 6162 psFree(md); 6089 6163 return false; … … 6096 6170 } 6097 6171 6098 bool rawDetrendExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char ** stats)6172 bool rawDetrendExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char **class, psF32 *airmass, psF32 *ra, psF32 *dec, psF32 *exp_time) 6099 6173 { 6100 6174 psArray *rowSet; … … 6176 6250 return false; 6177 6251 } 6178 *stats = psMetadataLookupPtr(&status, row, "stats"); 6179 if (!status) { 6180 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats"); 6252 *class = psMetadataLookupPtr(&status, row, "class"); 6253 if (!status) { 6254 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class"); 6255 psFree(row); 6256 return false; 6257 } 6258 *airmass = psMetadataLookupF32(&status, row, "airmass"); 6259 if (!status) { 6260 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass"); 6261 psFree(row); 6262 return false; 6263 } 6264 *ra = psMetadataLookupF32(&status, row, "ra"); 6265 if (!status) { 6266 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra"); 6267 psFree(row); 6268 return false; 6269 } 6270 *dec = psMetadataLookupF32(&status, row, "dec"); 6271 if (!status) { 6272 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec"); 6273 psFree(row); 6274 return false; 6275 } 6276 *exp_time = psMetadataLookupF32(&status, row, "exp_time"); 6277 if (!status) { 6278 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time"); 6181 6279 psFree(row); 6182 6280 return false; … … 6190 6288 bool rawDetrendExpInsertObject(psDB *dbh, rawDetrendExpRow *object) 6191 6289 { 6192 return rawDetrendExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object-> stats);6290 return rawDetrendExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object->class, object->airmass, object->ra, object->dec, object->exp_time); 6193 6291 } 6194 6292 … … 6201 6299 psS32 imfiles; 6202 6300 char filter[256]; 6203 char stats[256]; 6204 6205 if (!rawDetrendExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&stats)) { 6301 char class[256]; 6302 psF32 airmass; 6303 psF32 ra; 6304 psF32 dec; 6305 psF32 exp_time; 6306 6307 if (!rawDetrendExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&class, &airmass, &ra, &dec, &exp_time)) { 6206 6308 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 6207 6309 return NULL; 6208 6310 } 6209 6311 6210 return rawDetrendExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats);6312 return rawDetrendExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time); 6211 6313 } 6212 6314 … … 6337 6439 return NULL; 6338 6440 } 6339 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, object->stats)) { 6340 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 6441 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) { 6442 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 6443 psFree(md); 6444 return NULL; 6445 } 6446 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, object->airmass)) { 6447 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 6448 psFree(md); 6449 return NULL; 6450 } 6451 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, object->ra)) { 6452 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 6453 psFree(md); 6454 return NULL; 6455 } 6456 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, object->dec)) { 6457 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 6458 psFree(md); 6459 return NULL; 6460 } 6461 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, object->exp_time)) { 6462 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 6341 6463 psFree(md); 6342 6464 return NULL; … … 6355 6477 psS32 imfiles; 6356 6478 char *filter; 6357 char *stats; 6479 char *class; 6480 psF32 airmass; 6481 psF32 ra; 6482 psF32 dec; 6483 psF32 exp_time; 6358 6484 6359 6485 exp_id = psMetadataLookupPtr(&status, md, "exp_id"); … … 6387 6513 return false; 6388 6514 } 6389 stats = psMetadataLookupPtr(&status, md, "stats"); 6390 if (!status) { 6391 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats"); 6392 return false; 6393 } 6394 6395 return rawDetrendExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats); 6515 class = psMetadataLookupPtr(&status, md, "class"); 6516 if (!status) { 6517 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class"); 6518 return false; 6519 } 6520 airmass = psMetadataLookupF32(&status, md, "airmass"); 6521 if (!status) { 6522 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass"); 6523 return false; 6524 } 6525 ra = psMetadataLookupF32(&status, md, "ra"); 6526 if (!status) { 6527 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra"); 6528 return false; 6529 } 6530 dec = psMetadataLookupF32(&status, md, "dec"); 6531 if (!status) { 6532 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec"); 6533 return false; 6534 } 6535 exp_time = psMetadataLookupF32(&status, md, "exp_time"); 6536 if (!status) { 6537 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time"); 6538 return false; 6539 } 6540 6541 return rawDetrendExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time); 6396 6542 } 6397 6543 psArray *rawDetrendExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 6451 6597 static void rawScienceExpRowFree(rawScienceExpRow *object); 6452 6598 6453 rawScienceExpRow *rawScienceExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char * stats)6599 rawScienceExpRow *rawScienceExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time) 6454 6600 { 6455 6601 rawScienceExpRow *object; … … 6464 6610 object->imfiles = imfiles; 6465 6611 object->filter = psStringCopy(filter); 6466 object->stats = psStringCopy(stats); 6612 object->class = psStringCopy(class); 6613 object->airmass = airmass; 6614 object->ra = ra; 6615 object->dec = dec; 6616 object->exp_time = exp_time; 6467 6617 6468 6618 return object; … … 6476 6626 psFree(object->exp_type); 6477 6627 psFree(object->filter); 6478 psFree(object-> stats);6628 psFree(object->class); 6479 6629 } 6480 6630 … … 6520 6670 return false; 6521 6671 } 6522 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, "255")) { 6523 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 6672 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "255")) { 6673 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 6674 psFree(md); 6675 return false; 6676 } 6677 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, 0.0)) { 6678 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 6679 psFree(md); 6680 return false; 6681 } 6682 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, 0.0)) { 6683 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 6684 psFree(md); 6685 return false; 6686 } 6687 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, 0.0)) { 6688 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 6689 psFree(md); 6690 return false; 6691 } 6692 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, 0.0)) { 6693 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 6524 6694 psFree(md); 6525 6695 return false; … … 6538 6708 } 6539 6709 6540 bool rawScienceExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char * stats)6710 bool rawScienceExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time) 6541 6711 { 6542 6712 psMetadata *md; … … 6574 6744 return false; 6575 6745 } 6576 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, stats)) { 6577 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 6746 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) { 6747 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 6748 psFree(md); 6749 return false; 6750 } 6751 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, airmass)) { 6752 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 6753 psFree(md); 6754 return false; 6755 } 6756 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, ra)) { 6757 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 6758 psFree(md); 6759 return false; 6760 } 6761 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, dec)) { 6762 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 6763 psFree(md); 6764 return false; 6765 } 6766 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, exp_time)) { 6767 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 6578 6768 psFree(md); 6579 6769 return false; … … 6586 6776 } 6587 6777 6588 bool rawScienceExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char ** stats)6778 bool rawScienceExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char **class, psF32 *airmass, psF32 *ra, psF32 *dec, psF32 *exp_time) 6589 6779 { 6590 6780 psArray *rowSet; … … 6666 6856 return false; 6667 6857 } 6668 *stats = psMetadataLookupPtr(&status, row, "stats"); 6669 if (!status) { 6670 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats"); 6858 *class = psMetadataLookupPtr(&status, row, "class"); 6859 if (!status) { 6860 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class"); 6861 psFree(row); 6862 return false; 6863 } 6864 *airmass = psMetadataLookupF32(&status, row, "airmass"); 6865 if (!status) { 6866 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass"); 6867 psFree(row); 6868 return false; 6869 } 6870 *ra = psMetadataLookupF32(&status, row, "ra"); 6871 if (!status) { 6872 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra"); 6873 psFree(row); 6874 return false; 6875 } 6876 *dec = psMetadataLookupF32(&status, row, "dec"); 6877 if (!status) { 6878 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec"); 6879 psFree(row); 6880 return false; 6881 } 6882 *exp_time = psMetadataLookupF32(&status, row, "exp_time"); 6883 if (!status) { 6884 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time"); 6671 6885 psFree(row); 6672 6886 return false; … … 6680 6894 bool rawScienceExpInsertObject(psDB *dbh, rawScienceExpRow *object) 6681 6895 { 6682 return rawScienceExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object-> stats);6896 return rawScienceExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object->class, object->airmass, object->ra, object->dec, object->exp_time); 6683 6897 } 6684 6898 … … 6691 6905 psS32 imfiles; 6692 6906 char filter[256]; 6693 char stats[256]; 6694 6695 if (!rawScienceExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&stats)) { 6907 char class[256]; 6908 psF32 airmass; 6909 psF32 ra; 6910 psF32 dec; 6911 psF32 exp_time; 6912 6913 if (!rawScienceExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&class, &airmass, &ra, &dec, &exp_time)) { 6696 6914 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 6697 6915 return NULL; 6698 6916 } 6699 6917 6700 return rawScienceExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats);6918 return rawScienceExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time); 6701 6919 } 6702 6920 … … 6827 7045 return NULL; 6828 7046 } 6829 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, object->stats)) { 6830 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 7047 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) { 7048 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 7049 psFree(md); 7050 return NULL; 7051 } 7052 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, object->airmass)) { 7053 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 7054 psFree(md); 7055 return NULL; 7056 } 7057 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, object->ra)) { 7058 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 7059 psFree(md); 7060 return NULL; 7061 } 7062 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, object->dec)) { 7063 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 7064 psFree(md); 7065 return NULL; 7066 } 7067 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, object->exp_time)) { 7068 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 6831 7069 psFree(md); 6832 7070 return NULL; … … 6845 7083 psS32 imfiles; 6846 7084 char *filter; 6847 char *stats; 7085 char *class; 7086 psF32 airmass; 7087 psF32 ra; 7088 psF32 dec; 7089 psF32 exp_time; 6848 7090 6849 7091 exp_id = psMetadataLookupPtr(&status, md, "exp_id"); … … 6877 7119 return false; 6878 7120 } 6879 stats = psMetadataLookupPtr(&status, md, "stats"); 6880 if (!status) { 6881 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats"); 6882 return false; 6883 } 6884 6885 return rawScienceExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats); 7121 class = psMetadataLookupPtr(&status, md, "class"); 7122 if (!status) { 7123 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class"); 7124 return false; 7125 } 7126 airmass = psMetadataLookupF32(&status, md, "airmass"); 7127 if (!status) { 7128 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass"); 7129 return false; 7130 } 7131 ra = psMetadataLookupF32(&status, md, "ra"); 7132 if (!status) { 7133 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra"); 7134 return false; 7135 } 7136 dec = psMetadataLookupF32(&status, md, "dec"); 7137 if (!status) { 7138 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec"); 7139 return false; 7140 } 7141 exp_time = psMetadataLookupF32(&status, md, "exp_time"); 7142 if (!status) { 7143 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time"); 7144 return false; 7145 } 7146 7147 return rawScienceExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time); 6886 7148 } 6887 7149 psArray *rawScienceExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 7372 7634 static void p1PendingExpRowFree(p1PendingExpRow *object); 7373 7635 7374 p1PendingExpRow *p1PendingExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char * stats, const char *recipe, psS32 p1_version)7636 p1PendingExpRow *p1PendingExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time, const char *recipe, psS32 p1_version) 7375 7637 { 7376 7638 p1PendingExpRow *object; … … 7385 7647 object->imfiles = imfiles; 7386 7648 object->filter = psStringCopy(filter); 7387 object->stats = psStringCopy(stats); 7649 object->class = psStringCopy(class); 7650 object->airmass = airmass; 7651 object->ra = ra; 7652 object->dec = dec; 7653 object->exp_time = exp_time; 7388 7654 object->recipe = psStringCopy(recipe); 7389 7655 object->p1_version = p1_version; … … 7399 7665 psFree(object->exp_type); 7400 7666 psFree(object->filter); 7401 psFree(object-> stats);7667 psFree(object->class); 7402 7668 psFree(object->recipe); 7403 7669 } … … 7444 7710 return false; 7445 7711 } 7446 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, "255")) { 7447 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 7712 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "255")) { 7713 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 7714 psFree(md); 7715 return false; 7716 } 7717 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, 0.0)) { 7718 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 7719 psFree(md); 7720 return false; 7721 } 7722 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, 0.0)) { 7723 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 7724 psFree(md); 7725 return false; 7726 } 7727 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, 0.0)) { 7728 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 7729 psFree(md); 7730 return false; 7731 } 7732 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, 0.0)) { 7733 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 7448 7734 psFree(md); 7449 7735 return false; … … 7472 7758 } 7473 7759 7474 bool p1PendingExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char * stats, const char *recipe, psS32 p1_version)7760 bool p1PendingExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time, const char *recipe, psS32 p1_version) 7475 7761 { 7476 7762 psMetadata *md; … … 7508 7794 return false; 7509 7795 } 7510 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, stats)) { 7511 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 7796 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) { 7797 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 7798 psFree(md); 7799 return false; 7800 } 7801 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, airmass)) { 7802 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 7803 psFree(md); 7804 return false; 7805 } 7806 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, ra)) { 7807 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 7808 psFree(md); 7809 return false; 7810 } 7811 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, dec)) { 7812 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 7813 psFree(md); 7814 return false; 7815 } 7816 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, exp_time)) { 7817 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 7512 7818 psFree(md); 7513 7819 return false; … … 7530 7836 } 7531 7837 7532 bool p1PendingExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char ** stats, char **recipe, psS32 *p1_version)7838 bool p1PendingExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char **class, psF32 *airmass, psF32 *ra, psF32 *dec, psF32 *exp_time, char **recipe, psS32 *p1_version) 7533 7839 { 7534 7840 psArray *rowSet; … … 7610 7916 return false; 7611 7917 } 7612 *stats = psMetadataLookupPtr(&status, row, "stats"); 7613 if (!status) { 7614 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats"); 7918 *class = psMetadataLookupPtr(&status, row, "class"); 7919 if (!status) { 7920 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class"); 7921 psFree(row); 7922 return false; 7923 } 7924 *airmass = psMetadataLookupF32(&status, row, "airmass"); 7925 if (!status) { 7926 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass"); 7927 psFree(row); 7928 return false; 7929 } 7930 *ra = psMetadataLookupF32(&status, row, "ra"); 7931 if (!status) { 7932 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra"); 7933 psFree(row); 7934 return false; 7935 } 7936 *dec = psMetadataLookupF32(&status, row, "dec"); 7937 if (!status) { 7938 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec"); 7939 psFree(row); 7940 return false; 7941 } 7942 *exp_time = psMetadataLookupF32(&status, row, "exp_time"); 7943 if (!status) { 7944 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time"); 7615 7945 psFree(row); 7616 7946 return false; … … 7636 7966 bool p1PendingExpInsertObject(psDB *dbh, p1PendingExpRow *object) 7637 7967 { 7638 return p1PendingExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object-> stats, object->recipe, object->p1_version);7968 return p1PendingExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object->class, object->airmass, object->ra, object->dec, object->exp_time, object->recipe, object->p1_version); 7639 7969 } 7640 7970 … … 7647 7977 psS32 imfiles; 7648 7978 char filter[256]; 7649 char stats[256]; 7979 char class[256]; 7980 psF32 airmass; 7981 psF32 ra; 7982 psF32 dec; 7983 psF32 exp_time; 7650 7984 char recipe[256]; 7651 7985 psS32 p1_version; 7652 7986 7653 if (!p1PendingExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)& stats, (char **)&recipe, &p1_version)) {7987 if (!p1PendingExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&class, &airmass, &ra, &dec, &exp_time, (char **)&recipe, &p1_version)) { 7654 7988 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 7655 7989 return NULL; 7656 7990 } 7657 7991 7658 return p1PendingExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats, recipe, p1_version);7992 return p1PendingExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time, recipe, p1_version); 7659 7993 } 7660 7994 … … 7785 8119 return NULL; 7786 8120 } 7787 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, object->stats)) { 7788 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 8121 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) { 8122 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 8123 psFree(md); 8124 return NULL; 8125 } 8126 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, object->airmass)) { 8127 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 8128 psFree(md); 8129 return NULL; 8130 } 8131 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, object->ra)) { 8132 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 8133 psFree(md); 8134 return NULL; 8135 } 8136 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, object->dec)) { 8137 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 8138 psFree(md); 8139 return NULL; 8140 } 8141 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, object->exp_time)) { 8142 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 7789 8143 psFree(md); 7790 8144 return NULL; … … 7813 8167 psS32 imfiles; 7814 8168 char *filter; 7815 char *stats; 8169 char *class; 8170 psF32 airmass; 8171 psF32 ra; 8172 psF32 dec; 8173 psF32 exp_time; 7816 8174 char *recipe; 7817 8175 psS32 p1_version; … … 7847 8205 return false; 7848 8206 } 7849 stats = psMetadataLookupPtr(&status, md, "stats"); 7850 if (!status) { 7851 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats"); 8207 class = psMetadataLookupPtr(&status, md, "class"); 8208 if (!status) { 8209 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class"); 8210 return false; 8211 } 8212 airmass = psMetadataLookupF32(&status, md, "airmass"); 8213 if (!status) { 8214 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass"); 8215 return false; 8216 } 8217 ra = psMetadataLookupF32(&status, md, "ra"); 8218 if (!status) { 8219 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra"); 8220 return false; 8221 } 8222 dec = psMetadataLookupF32(&status, md, "dec"); 8223 if (!status) { 8224 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec"); 8225 return false; 8226 } 8227 exp_time = psMetadataLookupF32(&status, md, "exp_time"); 8228 if (!status) { 8229 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time"); 7852 8230 return false; 7853 8231 } … … 7863 8241 } 7864 8242 7865 return p1PendingExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats, recipe, p1_version);8243 return p1PendingExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time, recipe, p1_version); 7866 8244 } 7867 8245 psArray *p1PendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 7921 8299 static void p2PendingExpRowFree(p2PendingExpRow *object); 7922 8300 7923 p2PendingExpRow *p2PendingExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char * stats, const char *recipe, psS32 p1_version, psS32 p2_version)8301 p2PendingExpRow *p2PendingExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time, const char *recipe, psS32 p1_version, psS32 p2_version) 7924 8302 { 7925 8303 p2PendingExpRow *object; … … 7934 8312 object->imfiles = imfiles; 7935 8313 object->filter = psStringCopy(filter); 7936 object->stats = psStringCopy(stats); 8314 object->class = psStringCopy(class); 8315 object->airmass = airmass; 8316 object->ra = ra; 8317 object->dec = dec; 8318 object->exp_time = exp_time; 7937 8319 object->recipe = psStringCopy(recipe); 7938 8320 object->p1_version = p1_version; … … 7949 8331 psFree(object->exp_type); 7950 8332 psFree(object->filter); 7951 psFree(object-> stats);8333 psFree(object->class); 7952 8334 psFree(object->recipe); 7953 8335 } … … 7994 8376 return false; 7995 8377 } 7996 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, "255")) { 7997 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 8378 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "255")) { 8379 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 8380 psFree(md); 8381 return false; 8382 } 8383 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, 0.0)) { 8384 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 8385 psFree(md); 8386 return false; 8387 } 8388 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, 0.0)) { 8389 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 8390 psFree(md); 8391 return false; 8392 } 8393 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, 0.0)) { 8394 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 8395 psFree(md); 8396 return false; 8397 } 8398 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, 0.0)) { 8399 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 7998 8400 psFree(md); 7999 8401 return false; … … 8027 8429 } 8028 8430 8029 bool p2PendingExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char * stats, const char *recipe, psS32 p1_version, psS32 p2_version)8431 bool p2PendingExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time, const char *recipe, psS32 p1_version, psS32 p2_version) 8030 8432 { 8031 8433 psMetadata *md; … … 8063 8465 return false; 8064 8466 } 8065 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, stats)) { 8066 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 8467 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) { 8468 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 8469 psFree(md); 8470 return false; 8471 } 8472 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, airmass)) { 8473 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 8474 psFree(md); 8475 return false; 8476 } 8477 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, ra)) { 8478 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 8479 psFree(md); 8480 return false; 8481 } 8482 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, dec)) { 8483 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 8484 psFree(md); 8485 return false; 8486 } 8487 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, exp_time)) { 8488 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 8067 8489 psFree(md); 8068 8490 return false; … … 8090 8512 } 8091 8513 8092 bool p2PendingExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char ** stats, char **recipe, psS32 *p1_version, psS32 *p2_version)8514 bool p2PendingExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char **class, psF32 *airmass, psF32 *ra, psF32 *dec, psF32 *exp_time, char **recipe, psS32 *p1_version, psS32 *p2_version) 8093 8515 { 8094 8516 psArray *rowSet; … … 8170 8592 return false; 8171 8593 } 8172 *stats = psMetadataLookupPtr(&status, row, "stats"); 8173 if (!status) { 8174 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats"); 8594 *class = psMetadataLookupPtr(&status, row, "class"); 8595 if (!status) { 8596 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class"); 8597 psFree(row); 8598 return false; 8599 } 8600 *airmass = psMetadataLookupF32(&status, row, "airmass"); 8601 if (!status) { 8602 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass"); 8603 psFree(row); 8604 return false; 8605 } 8606 *ra = psMetadataLookupF32(&status, row, "ra"); 8607 if (!status) { 8608 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra"); 8609 psFree(row); 8610 return false; 8611 } 8612 *dec = psMetadataLookupF32(&status, row, "dec"); 8613 if (!status) { 8614 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec"); 8615 psFree(row); 8616 return false; 8617 } 8618 *exp_time = psMetadataLookupF32(&status, row, "exp_time"); 8619 if (!status) { 8620 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time"); 8175 8621 psFree(row); 8176 8622 return false; … … 8202 8648 bool p2PendingExpInsertObject(psDB *dbh, p2PendingExpRow *object) 8203 8649 { 8204 return p2PendingExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object-> stats, object->recipe, object->p1_version, object->p2_version);8650 return p2PendingExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object->class, object->airmass, object->ra, object->dec, object->exp_time, object->recipe, object->p1_version, object->p2_version); 8205 8651 } 8206 8652 … … 8213 8659 psS32 imfiles; 8214 8660 char filter[256]; 8215 char stats[256]; 8661 char class[256]; 8662 psF32 airmass; 8663 psF32 ra; 8664 psF32 dec; 8665 psF32 exp_time; 8216 8666 char recipe[256]; 8217 8667 psS32 p1_version; 8218 8668 psS32 p2_version; 8219 8669 8220 if (!p2PendingExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)& stats, (char **)&recipe, &p1_version, &p2_version)) {8670 if (!p2PendingExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&class, &airmass, &ra, &dec, &exp_time, (char **)&recipe, &p1_version, &p2_version)) { 8221 8671 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 8222 8672 return NULL; 8223 8673 } 8224 8674 8225 return p2PendingExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats, recipe, p1_version, p2_version);8675 return p2PendingExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time, recipe, p1_version, p2_version); 8226 8676 } 8227 8677 … … 8352 8802 return NULL; 8353 8803 } 8354 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, object->stats)) { 8355 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 8804 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) { 8805 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 8806 psFree(md); 8807 return NULL; 8808 } 8809 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, object->airmass)) { 8810 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 8811 psFree(md); 8812 return NULL; 8813 } 8814 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, object->ra)) { 8815 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 8816 psFree(md); 8817 return NULL; 8818 } 8819 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, object->dec)) { 8820 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 8821 psFree(md); 8822 return NULL; 8823 } 8824 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, object->exp_time)) { 8825 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 8356 8826 psFree(md); 8357 8827 return NULL; … … 8385 8855 psS32 imfiles; 8386 8856 char *filter; 8387 char *stats; 8857 char *class; 8858 psF32 airmass; 8859 psF32 ra; 8860 psF32 dec; 8861 psF32 exp_time; 8388 8862 char *recipe; 8389 8863 psS32 p1_version; … … 8420 8894 return false; 8421 8895 } 8422 stats = psMetadataLookupPtr(&status, md, "stats"); 8423 if (!status) { 8424 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats"); 8896 class = psMetadataLookupPtr(&status, md, "class"); 8897 if (!status) { 8898 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class"); 8899 return false; 8900 } 8901 airmass = psMetadataLookupF32(&status, md, "airmass"); 8902 if (!status) { 8903 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass"); 8904 return false; 8905 } 8906 ra = psMetadataLookupF32(&status, md, "ra"); 8907 if (!status) { 8908 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra"); 8909 return false; 8910 } 8911 dec = psMetadataLookupF32(&status, md, "dec"); 8912 if (!status) { 8913 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec"); 8914 return false; 8915 } 8916 exp_time = psMetadataLookupF32(&status, md, "exp_time"); 8917 if (!status) { 8918 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time"); 8425 8919 return false; 8426 8920 } … … 8441 8935 } 8442 8936 8443 return p2PendingExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats, recipe, p1_version, p2_version);8937 return p2PendingExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time, recipe, p1_version, p2_version); 8444 8938 } 8445 8939 psArray *p2PendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 8988 9482 static void p2DoneExpRowFree(p2DoneExpRow *object); 8989 9483 8990 p2DoneExpRow *p2DoneExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char * stats, const char *recipe, psS32 p1_version, psS32 p2_version)9484 p2DoneExpRow *p2DoneExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time, const char *recipe, psS32 p1_version, psS32 p2_version) 8991 9485 { 8992 9486 p2DoneExpRow *object; … … 9001 9495 object->imfiles = imfiles; 9002 9496 object->filter = psStringCopy(filter); 9003 object->stats = psStringCopy(stats); 9497 object->class = psStringCopy(class); 9498 object->airmass = airmass; 9499 object->ra = ra; 9500 object->dec = dec; 9501 object->exp_time = exp_time; 9004 9502 object->recipe = psStringCopy(recipe); 9005 9503 object->p1_version = p1_version; … … 9016 9514 psFree(object->exp_type); 9017 9515 psFree(object->filter); 9018 psFree(object-> stats);9516 psFree(object->class); 9019 9517 psFree(object->recipe); 9020 9518 } … … 9061 9559 return false; 9062 9560 } 9063 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, "255")) { 9064 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 9561 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "255")) { 9562 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 9563 psFree(md); 9564 return false; 9565 } 9566 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, 0.0)) { 9567 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 9568 psFree(md); 9569 return false; 9570 } 9571 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, 0.0)) { 9572 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 9573 psFree(md); 9574 return false; 9575 } 9576 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, 0.0)) { 9577 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 9578 psFree(md); 9579 return false; 9580 } 9581 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, 0.0)) { 9582 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 9065 9583 psFree(md); 9066 9584 return false; … … 9094 9612 } 9095 9613 9096 bool p2DoneExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char * stats, const char *recipe, psS32 p1_version, psS32 p2_version)9614 bool p2DoneExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time, const char *recipe, psS32 p1_version, psS32 p2_version) 9097 9615 { 9098 9616 psMetadata *md; … … 9130 9648 return false; 9131 9649 } 9132 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, stats)) { 9133 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 9650 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) { 9651 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 9652 psFree(md); 9653 return false; 9654 } 9655 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, airmass)) { 9656 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 9657 psFree(md); 9658 return false; 9659 } 9660 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, ra)) { 9661 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 9662 psFree(md); 9663 return false; 9664 } 9665 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, dec)) { 9666 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 9667 psFree(md); 9668 return false; 9669 } 9670 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, exp_time)) { 9671 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 9134 9672 psFree(md); 9135 9673 return false; … … 9157 9695 } 9158 9696 9159 bool p2DoneExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char ** stats, char **recipe, psS32 *p1_version, psS32 *p2_version)9697 bool p2DoneExpPop(psDB *dbh, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char **class, psF32 *airmass, psF32 *ra, psF32 *dec, psF32 *exp_time, char **recipe, psS32 *p1_version, psS32 *p2_version) 9160 9698 { 9161 9699 psArray *rowSet; … … 9237 9775 return false; 9238 9776 } 9239 *stats = psMetadataLookupPtr(&status, row, "stats"); 9240 if (!status) { 9241 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats"); 9777 *class = psMetadataLookupPtr(&status, row, "class"); 9778 if (!status) { 9779 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class"); 9780 psFree(row); 9781 return false; 9782 } 9783 *airmass = psMetadataLookupF32(&status, row, "airmass"); 9784 if (!status) { 9785 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass"); 9786 psFree(row); 9787 return false; 9788 } 9789 *ra = psMetadataLookupF32(&status, row, "ra"); 9790 if (!status) { 9791 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra"); 9792 psFree(row); 9793 return false; 9794 } 9795 *dec = psMetadataLookupF32(&status, row, "dec"); 9796 if (!status) { 9797 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec"); 9798 psFree(row); 9799 return false; 9800 } 9801 *exp_time = psMetadataLookupF32(&status, row, "exp_time"); 9802 if (!status) { 9803 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time"); 9242 9804 psFree(row); 9243 9805 return false; … … 9269 9831 bool p2DoneExpInsertObject(psDB *dbh, p2DoneExpRow *object) 9270 9832 { 9271 return p2DoneExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object-> stats, object->recipe, object->p1_version, object->p2_version);9833 return p2DoneExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object->class, object->airmass, object->ra, object->dec, object->exp_time, object->recipe, object->p1_version, object->p2_version); 9272 9834 } 9273 9835 … … 9280 9842 psS32 imfiles; 9281 9843 char filter[256]; 9282 char stats[256]; 9844 char class[256]; 9845 psF32 airmass; 9846 psF32 ra; 9847 psF32 dec; 9848 psF32 exp_time; 9283 9849 char recipe[256]; 9284 9850 psS32 p1_version; 9285 9851 psS32 p2_version; 9286 9852 9287 if (!p2DoneExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)& stats, (char **)&recipe, &p1_version, &p2_version)) {9853 if (!p2DoneExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&class, &airmass, &ra, &dec, &exp_time, (char **)&recipe, &p1_version, &p2_version)) { 9288 9854 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 9289 9855 return NULL; 9290 9856 } 9291 9857 9292 return p2DoneExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats, recipe, p1_version, p2_version);9858 return p2DoneExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time, recipe, p1_version, p2_version); 9293 9859 } 9294 9860 … … 9419 9985 return NULL; 9420 9986 } 9421 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, object->stats)) { 9422 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 9987 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) { 9988 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 9989 psFree(md); 9990 return NULL; 9991 } 9992 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, object->airmass)) { 9993 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 9994 psFree(md); 9995 return NULL; 9996 } 9997 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, object->ra)) { 9998 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 9999 psFree(md); 10000 return NULL; 10001 } 10002 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, object->dec)) { 10003 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 10004 psFree(md); 10005 return NULL; 10006 } 10007 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, object->exp_time)) { 10008 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 9423 10009 psFree(md); 9424 10010 return NULL; … … 9452 10038 psS32 imfiles; 9453 10039 char *filter; 9454 char *stats; 10040 char *class; 10041 psF32 airmass; 10042 psF32 ra; 10043 psF32 dec; 10044 psF32 exp_time; 9455 10045 char *recipe; 9456 10046 psS32 p1_version; … … 9487 10077 return false; 9488 10078 } 9489 stats = psMetadataLookupPtr(&status, md, "stats"); 9490 if (!status) { 9491 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats"); 10079 class = psMetadataLookupPtr(&status, md, "class"); 10080 if (!status) { 10081 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class"); 10082 return false; 10083 } 10084 airmass = psMetadataLookupF32(&status, md, "airmass"); 10085 if (!status) { 10086 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass"); 10087 return false; 10088 } 10089 ra = psMetadataLookupF32(&status, md, "ra"); 10090 if (!status) { 10091 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra"); 10092 return false; 10093 } 10094 dec = psMetadataLookupF32(&status, md, "dec"); 10095 if (!status) { 10096 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec"); 10097 return false; 10098 } 10099 exp_time = psMetadataLookupF32(&status, md, "exp_time"); 10100 if (!status) { 10101 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time"); 9492 10102 return false; 9493 10103 } … … 9508 10118 } 9509 10119 9510 return p2DoneExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, stats, recipe, p1_version, p2_version);10120 return p2DoneExpRowAlloc(exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time, recipe, p1_version, p2_version); 9511 10121 } 9512 10122 psArray *p2DoneExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 10055 10665 static void p3PendingExpRowFree(p3PendingExpRow *object); 10056 10666 10057 p3PendingExpRow *p3PendingExpRowAlloc(const char *exp_id, const char *camera, const char *exp_type, psS32 imfiles, const char *filter, const char * stats, const char *recipe, psS32 p2_version, psS32 p3_version)10667 p3PendingExpRow *p3PendingExpRowAlloc(const char *exp_id, const char *camera, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time, const char *recipe, psS32 p2_version, psS32 p3_version) 10058 10668 { 10059 10669 p3PendingExpRow *object; … … 10067 10677 object->imfiles = imfiles; 10068 10678 object->filter = psStringCopy(filter); 10069 object->stats = psStringCopy(stats); 10679 object->class = psStringCopy(class); 10680 object->airmass = airmass; 10681 object->ra = ra; 10682 object->dec = dec; 10683 object->exp_time = exp_time; 10070 10684 object->recipe = psStringCopy(recipe); 10071 10685 object->p2_version = p2_version; … … 10081 10695 psFree(object->exp_type); 10082 10696 psFree(object->filter); 10083 psFree(object-> stats);10697 psFree(object->class); 10084 10698 psFree(object->recipe); 10085 10699 } … … 10121 10735 return false; 10122 10736 } 10123 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, "255")) { 10124 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 10737 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "255")) { 10738 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 10739 psFree(md); 10740 return false; 10741 } 10742 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, 0.0)) { 10743 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 10744 psFree(md); 10745 return false; 10746 } 10747 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, 0.0)) { 10748 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 10749 psFree(md); 10750 return false; 10751 } 10752 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, 0.0)) { 10753 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 10754 psFree(md); 10755 return false; 10756 } 10757 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, 0.0)) { 10758 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 10125 10759 psFree(md); 10126 10760 return false; … … 10154 10788 } 10155 10789 10156 bool p3PendingExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *exp_type, psS32 imfiles, const char *filter, const char * stats, const char *recipe, psS32 p2_version, psS32 p3_version)10790 bool p3PendingExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time, const char *recipe, psS32 p2_version, psS32 p3_version) 10157 10791 { 10158 10792 psMetadata *md; … … 10185 10819 return false; 10186 10820 } 10187 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, stats)) { 10188 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 10821 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) { 10822 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 10823 psFree(md); 10824 return false; 10825 } 10826 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, airmass)) { 10827 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 10828 psFree(md); 10829 return false; 10830 } 10831 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, ra)) { 10832 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 10833 psFree(md); 10834 return false; 10835 } 10836 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, dec)) { 10837 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 10838 psFree(md); 10839 return false; 10840 } 10841 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, exp_time)) { 10842 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 10189 10843 psFree(md); 10190 10844 return false; … … 10212 10866 } 10213 10867 10214 bool p3PendingExpPop(psDB *dbh, char **exp_id, char **camera, char **exp_type, psS32 *imfiles, char **filter, char ** stats, char **recipe, psS32 *p2_version, psS32 *p3_version)10868 bool p3PendingExpPop(psDB *dbh, char **exp_id, char **camera, char **exp_type, psS32 *imfiles, char **filter, char **class, psF32 *airmass, psF32 *ra, psF32 *dec, psF32 *exp_time, char **recipe, psS32 *p2_version, psS32 *p3_version) 10215 10869 { 10216 10870 psArray *rowSet; … … 10286 10940 return false; 10287 10941 } 10288 *stats = psMetadataLookupPtr(&status, row, "stats"); 10289 if (!status) { 10290 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats"); 10942 *class = psMetadataLookupPtr(&status, row, "class"); 10943 if (!status) { 10944 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class"); 10945 psFree(row); 10946 return false; 10947 } 10948 *airmass = psMetadataLookupF32(&status, row, "airmass"); 10949 if (!status) { 10950 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass"); 10951 psFree(row); 10952 return false; 10953 } 10954 *ra = psMetadataLookupF32(&status, row, "ra"); 10955 if (!status) { 10956 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra"); 10957 psFree(row); 10958 return false; 10959 } 10960 *dec = psMetadataLookupF32(&status, row, "dec"); 10961 if (!status) { 10962 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec"); 10963 psFree(row); 10964 return false; 10965 } 10966 *exp_time = psMetadataLookupF32(&status, row, "exp_time"); 10967 if (!status) { 10968 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time"); 10291 10969 psFree(row); 10292 10970 return false; … … 10318 10996 bool p3PendingExpInsertObject(psDB *dbh, p3PendingExpRow *object) 10319 10997 { 10320 return p3PendingExpInsert(dbh, object->exp_id, object->camera, object->exp_type, object->imfiles, object->filter, object-> stats, object->recipe, object->p2_version, object->p3_version);10998 return p3PendingExpInsert(dbh, object->exp_id, object->camera, object->exp_type, object->imfiles, object->filter, object->class, object->airmass, object->ra, object->dec, object->exp_time, object->recipe, object->p2_version, object->p3_version); 10321 10999 } 10322 11000 … … 10328 11006 psS32 imfiles; 10329 11007 char filter[256]; 10330 char stats[256]; 11008 char class[256]; 11009 psF32 airmass; 11010 psF32 ra; 11011 psF32 dec; 11012 psF32 exp_time; 10331 11013 char recipe[256]; 10332 11014 psS32 p2_version; 10333 11015 psS32 p3_version; 10334 11016 10335 if (!p3PendingExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&exp_type, &imfiles, (char **)&filter, (char **)& stats, (char **)&recipe, &p2_version, &p3_version)) {11017 if (!p3PendingExpPop(dbh, (char **)&exp_id, (char **)&camera, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&class, &airmass, &ra, &dec, &exp_time, (char **)&recipe, &p2_version, &p3_version)) { 10336 11018 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 10337 11019 return NULL; 10338 11020 } 10339 11021 10340 return p3PendingExpRowAlloc(exp_id, camera, exp_type, imfiles, filter, stats, recipe, p2_version, p3_version);11022 return p3PendingExpRowAlloc(exp_id, camera, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time, recipe, p2_version, p3_version); 10341 11023 } 10342 11024 … … 10462 11144 return NULL; 10463 11145 } 10464 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, object->stats)) { 10465 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 11146 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) { 11147 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 11148 psFree(md); 11149 return NULL; 11150 } 11151 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, object->airmass)) { 11152 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 11153 psFree(md); 11154 return NULL; 11155 } 11156 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, object->ra)) { 11157 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 11158 psFree(md); 11159 return NULL; 11160 } 11161 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, object->dec)) { 11162 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 11163 psFree(md); 11164 return NULL; 11165 } 11166 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, object->exp_time)) { 11167 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 10466 11168 psFree(md); 10467 11169 return NULL; … … 10494 11196 psS32 imfiles; 10495 11197 char *filter; 10496 char *stats; 11198 char *class; 11199 psF32 airmass; 11200 psF32 ra; 11201 psF32 dec; 11202 psF32 exp_time; 10497 11203 char *recipe; 10498 11204 psS32 p2_version; … … 10524 11230 return false; 10525 11231 } 10526 stats = psMetadataLookupPtr(&status, md, "stats"); 10527 if (!status) { 10528 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats"); 11232 class = psMetadataLookupPtr(&status, md, "class"); 11233 if (!status) { 11234 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class"); 11235 return false; 11236 } 11237 airmass = psMetadataLookupF32(&status, md, "airmass"); 11238 if (!status) { 11239 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass"); 11240 return false; 11241 } 11242 ra = psMetadataLookupF32(&status, md, "ra"); 11243 if (!status) { 11244 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra"); 11245 return false; 11246 } 11247 dec = psMetadataLookupF32(&status, md, "dec"); 11248 if (!status) { 11249 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec"); 11250 return false; 11251 } 11252 exp_time = psMetadataLookupF32(&status, md, "exp_time"); 11253 if (!status) { 11254 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time"); 10529 11255 return false; 10530 11256 } … … 10545 11271 } 10546 11272 10547 return p3PendingExpRowAlloc(exp_id, camera, exp_type, imfiles, filter, stats, recipe, p2_version, p3_version);11273 return p3PendingExpRowAlloc(exp_id, camera, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time, recipe, p2_version, p3_version); 10548 11274 } 10549 11275 psArray *p3PendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 10943 11669 static void detInputExpRowFree(detInputExpRow *object); 10944 11670 10945 detInputExpRow *detInputExpRowAlloc(psS32 det_id, psS32 iteration, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char * stats)11671 detInputExpRow *detInputExpRowAlloc(psS32 det_id, psS32 iteration, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time) 10946 11672 { 10947 11673 detInputExpRow *object; … … 10958 11684 object->imfiles = imfiles; 10959 11685 object->filter = psStringCopy(filter); 10960 object->stats = psStringCopy(stats); 11686 object->class = psStringCopy(class); 11687 object->airmass = airmass; 11688 object->ra = ra; 11689 object->dec = dec; 11690 object->exp_time = exp_time; 10961 11691 10962 11692 return object; … … 10970 11700 psFree(object->exp_type); 10971 11701 psFree(object->filter); 10972 psFree(object-> stats);11702 psFree(object->class); 10973 11703 } 10974 11704 … … 11024 11754 return false; 11025 11755 } 11026 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, "255")) { 11027 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 11756 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "255")) { 11757 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 11758 psFree(md); 11759 return false; 11760 } 11761 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, 0.0)) { 11762 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 11763 psFree(md); 11764 return false; 11765 } 11766 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, 0.0)) { 11767 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 11768 psFree(md); 11769 return false; 11770 } 11771 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, 0.0)) { 11772 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 11773 psFree(md); 11774 return false; 11775 } 11776 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, 0.0)) { 11777 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 11028 11778 psFree(md); 11029 11779 return false; … … 11042 11792 } 11043 11793 11044 bool detInputExpInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char * stats)11794 bool detInputExpInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, psS32 imfiles, const char *filter, const char *class, psF32 airmass, psF32 ra, psF32 dec, psF32 exp_time) 11045 11795 { 11046 11796 psMetadata *md; … … 11088 11838 return false; 11089 11839 } 11090 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, stats)) { 11091 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 11840 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) { 11841 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 11842 psFree(md); 11843 return false; 11844 } 11845 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, airmass)) { 11846 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 11847 psFree(md); 11848 return false; 11849 } 11850 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, ra)) { 11851 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 11852 psFree(md); 11853 return false; 11854 } 11855 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, dec)) { 11856 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 11857 psFree(md); 11858 return false; 11859 } 11860 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, exp_time)) { 11861 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 11092 11862 psFree(md); 11093 11863 return false; … … 11100 11870 } 11101 11871 11102 bool detInputExpPop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char ** stats)11872 bool detInputExpPop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **exp_id, char **camera, char **telescope, char **exp_type, psS32 *imfiles, char **filter, char **class, psF32 *airmass, psF32 *ra, psF32 *dec, psF32 *exp_time) 11103 11873 { 11104 11874 psArray *rowSet; … … 11192 11962 return false; 11193 11963 } 11194 *stats = psMetadataLookupPtr(&status, row, "stats"); 11195 if (!status) { 11196 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats"); 11964 *class = psMetadataLookupPtr(&status, row, "class"); 11965 if (!status) { 11966 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class"); 11967 psFree(row); 11968 return false; 11969 } 11970 *airmass = psMetadataLookupF32(&status, row, "airmass"); 11971 if (!status) { 11972 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass"); 11973 psFree(row); 11974 return false; 11975 } 11976 *ra = psMetadataLookupF32(&status, row, "ra"); 11977 if (!status) { 11978 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra"); 11979 psFree(row); 11980 return false; 11981 } 11982 *dec = psMetadataLookupF32(&status, row, "dec"); 11983 if (!status) { 11984 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec"); 11985 psFree(row); 11986 return false; 11987 } 11988 *exp_time = psMetadataLookupF32(&status, row, "exp_time"); 11989 if (!status) { 11990 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time"); 11197 11991 psFree(row); 11198 11992 return false; … … 11206 12000 bool detInputExpInsertObject(psDB *dbh, detInputExpRow *object) 11207 12001 { 11208 return detInputExpInsert(dbh, object->det_id, object->iteration, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object-> stats);12002 return detInputExpInsert(dbh, object->det_id, object->iteration, object->exp_id, object->camera, object->telescope, object->exp_type, object->imfiles, object->filter, object->class, object->airmass, object->ra, object->dec, object->exp_time); 11209 12003 } 11210 12004 … … 11219 12013 psS32 imfiles; 11220 12014 char filter[256]; 11221 char stats[256]; 11222 11223 if (!detInputExpPop(dbh, &det_id, &iteration, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&stats)) { 12015 char class[256]; 12016 psF32 airmass; 12017 psF32 ra; 12018 psF32 dec; 12019 psF32 exp_time; 12020 12021 if (!detInputExpPop(dbh, &det_id, &iteration, (char **)&exp_id, (char **)&camera, (char **)&telescope, (char **)&exp_type, &imfiles, (char **)&filter, (char **)&class, &airmass, &ra, &dec, &exp_time)) { 11224 12022 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 11225 12023 return NULL; 11226 12024 } 11227 12025 11228 return detInputExpRowAlloc(det_id, iteration, exp_id, camera, telescope, exp_type, imfiles, filter, stats);12026 return detInputExpRowAlloc(det_id, iteration, exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time); 11229 12027 } 11230 12028 … … 11365 12163 return NULL; 11366 12164 } 11367 if (!psMetadataAddStr(md, PS_LIST_TAIL, "stats", 0, NULL, object->stats)) { 11368 psError(PS_ERR_UNKNOWN, false, "failed to add item stats"); 12165 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) { 12166 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 12167 psFree(md); 12168 return NULL; 12169 } 12170 if (!psMetadataAddF32(md, PS_LIST_TAIL, "airmass", 0, NULL, object->airmass)) { 12171 psError(PS_ERR_UNKNOWN, false, "failed to add item airmass"); 12172 psFree(md); 12173 return NULL; 12174 } 12175 if (!psMetadataAddF32(md, PS_LIST_TAIL, "ra", 0, NULL, object->ra)) { 12176 psError(PS_ERR_UNKNOWN, false, "failed to add item ra"); 12177 psFree(md); 12178 return NULL; 12179 } 12180 if (!psMetadataAddF32(md, PS_LIST_TAIL, "dec", 0, NULL, object->dec)) { 12181 psError(PS_ERR_UNKNOWN, false, "failed to add item dec"); 12182 psFree(md); 12183 return NULL; 12184 } 12185 if (!psMetadataAddF32(md, PS_LIST_TAIL, "exp_time", 0, NULL, object->exp_time)) { 12186 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_time"); 11369 12187 psFree(md); 11370 12188 return NULL; … … 11385 12203 psS32 imfiles; 11386 12204 char *filter; 11387 char *stats; 12205 char *class; 12206 psF32 airmass; 12207 psF32 ra; 12208 psF32 dec; 12209 psF32 exp_time; 11388 12210 11389 12211 det_id = psMetadataLookupS32(&status, md, "det_id"); … … 11427 12249 return false; 11428 12250 } 11429 stats = psMetadataLookupPtr(&status, md, "stats"); 11430 if (!status) { 11431 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stats"); 11432 return false; 11433 } 11434 11435 return detInputExpRowAlloc(det_id, iteration, exp_id, camera, telescope, exp_type, imfiles, filter, stats); 12251 class = psMetadataLookupPtr(&status, md, "class"); 12252 if (!status) { 12253 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class"); 12254 return false; 12255 } 12256 airmass = psMetadataLookupF32(&status, md, "airmass"); 12257 if (!status) { 12258 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item airmass"); 12259 return false; 12260 } 12261 ra = psMetadataLookupF32(&status, md, "ra"); 12262 if (!status) { 12263 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item ra"); 12264 return false; 12265 } 12266 dec = psMetadataLookupF32(&status, md, "dec"); 12267 if (!status) { 12268 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item dec"); 12269 return false; 12270 } 12271 exp_time = psMetadataLookupF32(&status, md, "exp_time"); 12272 if (!status) { 12273 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_time"); 12274 return false; 12275 } 12276 12277 return detInputExpRowAlloc(det_id, iteration, exp_id, camera, telescope, exp_type, imfiles, filter, class, airmass, ra, dec, exp_time); 11436 12278 } 11437 12279 psArray *detInputExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Note:
See TracChangeset
for help on using the changeset viewer.
