Changeset 11113 for trunk/ippdb/src/ippdb.c
- Timestamp:
- Jan 16, 2007, 12:21:17 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippdb/src/ippdb.c (modified) (72 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/src/ippdb.c
r11077 r11113 9224 9224 static void detProcessedImfileRowFree(detProcessedImfileRow *object); 9225 9225 9226 detProcessedImfileRow *detProcessedImfileRowAlloc(psS32 det_id, const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri )9226 detProcessedImfileRow *detProcessedImfileRowAlloc(psS32 det_id, const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS16 fault) 9227 9227 { 9228 9228 detProcessedImfileRow *_object; … … 9241 9241 _object->b1_uri = psStringCopy(b1_uri); 9242 9242 _object->b2_uri = psStringCopy(b2_uri); 9243 _object->fault = fault; 9243 9244 9244 9245 return _object; … … 9308 9309 return false; 9309 9310 } 9311 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) { 9312 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 9313 psFree(md); 9314 return false; 9315 } 9310 9316 9311 9317 bool status = psDBCreateTable(dbh, DETPROCESSEDIMFILE_TABLE_NAME, md); … … 9321 9327 } 9322 9328 9323 bool detProcessedImfileInsert(psDB * dbh, psS32 det_id, const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri )9329 bool detProcessedImfileInsert(psDB * dbh, psS32 det_id, const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS16 fault) 9324 9330 { 9325 9331 psMetadata *md = psMetadataAlloc(); … … 9371 9377 if (!psMetadataAdd(md, PS_LIST_TAIL, "b2_uri", PS_DATA_STRING, NULL, b2_uri)) { 9372 9378 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 9379 psFree(md); 9380 return false; 9381 } 9382 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) { 9383 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 9373 9384 psFree(md); 9374 9385 return false; … … 9397 9408 bool detProcessedImfileInsertObject(psDB *dbh, detProcessedImfileRow *object) 9398 9409 { 9399 return detProcessedImfileInsert(dbh, object->det_id, object->exp_tag, object->class_id, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri );9410 return detProcessedImfileInsert(dbh, object->det_id, object->exp_tag, object->class_id, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri, object->fault); 9400 9411 } 9401 9412 … … 9520 9531 return false; 9521 9532 } 9533 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) { 9534 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 9535 psFree(md); 9536 return false; 9537 } 9522 9538 9523 9539 … … 9579 9595 return false; 9580 9596 } 9581 9582 return detProcessedImfileRowAlloc(det_id, exp_tag, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri); 9597 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 9598 if (!status) { 9599 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault"); 9600 return false; 9601 } 9602 9603 return detProcessedImfileRowAlloc(det_id, exp_tag, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri, fault); 9583 9604 } 9584 9605 psArray *detProcessedImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 9692 9713 static void detProcessedExpRowFree(detProcessedExpRow *object); 9693 9714 9694 detProcessedExpRow *detProcessedExpRowAlloc(psS32 det_id, const char *exp_tag, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri )9715 detProcessedExpRow *detProcessedExpRowAlloc(psS32 det_id, const char *exp_tag, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS16 fault) 9695 9716 { 9696 9717 detProcessedExpRow *_object; … … 9707 9728 _object->b1_uri = psStringCopy(b1_uri); 9708 9729 _object->b2_uri = psStringCopy(b2_uri); 9730 _object->fault = fault; 9709 9731 9710 9732 return _object; … … 9762 9784 return false; 9763 9785 } 9786 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) { 9787 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 9788 psFree(md); 9789 return false; 9790 } 9764 9791 9765 9792 bool status = psDBCreateTable(dbh, DETPROCESSEDEXP_TABLE_NAME, md); … … 9775 9802 } 9776 9803 9777 bool detProcessedExpInsert(psDB * dbh, psS32 det_id, const char *exp_tag, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri )9804 bool detProcessedExpInsert(psDB * dbh, psS32 det_id, const char *exp_tag, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS16 fault) 9778 9805 { 9779 9806 psMetadata *md = psMetadataAlloc(); … … 9815 9842 if (!psMetadataAdd(md, PS_LIST_TAIL, "b2_uri", PS_DATA_STRING, NULL, b2_uri)) { 9816 9843 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 9844 psFree(md); 9845 return false; 9846 } 9847 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) { 9848 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 9817 9849 psFree(md); 9818 9850 return false; … … 9841 9873 bool detProcessedExpInsertObject(psDB *dbh, detProcessedExpRow *object) 9842 9874 { 9843 return detProcessedExpInsert(dbh, object->det_id, object->exp_tag, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri );9875 return detProcessedExpInsert(dbh, object->det_id, object->exp_tag, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri, object->fault); 9844 9876 } 9845 9877 … … 9954 9986 return false; 9955 9987 } 9988 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) { 9989 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 9990 psFree(md); 9991 return false; 9992 } 9956 9993 9957 9994 … … 10003 10040 return false; 10004 10041 } 10005 10006 return detProcessedExpRowAlloc(det_id, exp_tag, recipe, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri); 10042 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 10043 if (!status) { 10044 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault"); 10045 return false; 10046 } 10047 10048 return detProcessedExpRowAlloc(det_id, exp_tag, recipe, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri, fault); 10007 10049 } 10008 10050 psArray *detProcessedExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 10116 10158 static void detStackedImfileRowFree(detStackedImfileRow *object); 10117 10159 10118 detStackedImfileRow *detStackedImfileRowAlloc(psS32 det_id, psS32 iteration, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev )10160 detStackedImfileRow *detStackedImfileRowAlloc(psS32 det_id, psS32 iteration, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psS16 fault) 10119 10161 { 10120 10162 detStackedImfileRow *_object; … … 10131 10173 _object->bg_stdev = bg_stdev; 10132 10174 _object->bg_mean_stdev = bg_mean_stdev; 10175 _object->fault = fault; 10133 10176 10134 10177 return _object; … … 10185 10228 return false; 10186 10229 } 10230 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) { 10231 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 10232 psFree(md); 10233 return false; 10234 } 10187 10235 10188 10236 bool status = psDBCreateTable(dbh, DETSTACKEDIMFILE_TABLE_NAME, md); … … 10198 10246 } 10199 10247 10200 bool detStackedImfileInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev )10248 bool detStackedImfileInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psS16 fault) 10201 10249 { 10202 10250 psMetadata *md = psMetadataAlloc(); … … 10238 10286 if (!psMetadataAdd(md, PS_LIST_TAIL, "bg_mean_stdev", PS_DATA_F64, NULL, bg_mean_stdev)) { 10239 10287 psError(PS_ERR_UNKNOWN, false, "failed to add item bg_mean_stdev"); 10288 psFree(md); 10289 return false; 10290 } 10291 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) { 10292 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 10240 10293 psFree(md); 10241 10294 return false; … … 10264 10317 bool detStackedImfileInsertObject(psDB *dbh, detStackedImfileRow *object) 10265 10318 { 10266 return detStackedImfileInsert(dbh, object->det_id, object->iteration, object->class_id, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev );10319 return detStackedImfileInsert(dbh, object->det_id, object->iteration, object->class_id, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->fault); 10267 10320 } 10268 10321 … … 10377 10430 return false; 10378 10431 } 10432 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) { 10433 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 10434 psFree(md); 10435 return false; 10436 } 10379 10437 10380 10438 … … 10426 10484 return false; 10427 10485 } 10428 10429 return detStackedImfileRowAlloc(det_id, iteration, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev); 10486 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 10487 if (!status) { 10488 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault"); 10489 return false; 10490 } 10491 10492 return detStackedImfileRowAlloc(det_id, iteration, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev, fault); 10430 10493 } 10431 10494 psArray *detStackedImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 10539 10602 static void detNormalizedStatImfileRowFree(detNormalizedStatImfileRow *object); 10540 10603 10541 detNormalizedStatImfileRow *detNormalizedStatImfileRowAlloc(psS32 det_id, psS32 iteration, const char *class_id, psF32 norm )10604 detNormalizedStatImfileRow *detNormalizedStatImfileRowAlloc(psS32 det_id, psS32 iteration, const char *class_id, psF32 norm, psS16 fault) 10542 10605 { 10543 10606 detNormalizedStatImfileRow *_object; … … 10550 10613 _object->class_id = psStringCopy(class_id); 10551 10614 _object->norm = norm; 10615 _object->fault = fault; 10552 10616 10553 10617 return _object; … … 10582 10646 return false; 10583 10647 } 10648 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) { 10649 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 10650 psFree(md); 10651 return false; 10652 } 10584 10653 10585 10654 bool status = psDBCreateTable(dbh, DETNORMALIZEDSTATIMFILE_TABLE_NAME, md); … … 10595 10664 } 10596 10665 10597 bool detNormalizedStatImfileInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *class_id, psF32 norm )10666 bool detNormalizedStatImfileInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *class_id, psF32 norm, psS16 fault) 10598 10667 { 10599 10668 psMetadata *md = psMetadataAlloc(); … … 10615 10684 if (!psMetadataAdd(md, PS_LIST_TAIL, "norm", PS_DATA_F32, NULL, norm)) { 10616 10685 psError(PS_ERR_UNKNOWN, false, "failed to add item norm"); 10686 psFree(md); 10687 return false; 10688 } 10689 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) { 10690 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 10617 10691 psFree(md); 10618 10692 return false; … … 10641 10715 bool detNormalizedStatImfileInsertObject(psDB *dbh, detNormalizedStatImfileRow *object) 10642 10716 { 10643 return detNormalizedStatImfileInsert(dbh, object->det_id, object->iteration, object->class_id, object->norm );10717 return detNormalizedStatImfileInsert(dbh, object->det_id, object->iteration, object->class_id, object->norm, object->fault); 10644 10718 } 10645 10719 … … 10734 10808 return false; 10735 10809 } 10810 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) { 10811 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 10812 psFree(md); 10813 return false; 10814 } 10736 10815 10737 10816 … … 10763 10842 return false; 10764 10843 } 10765 10766 return detNormalizedStatImfileRowAlloc(det_id, iteration, class_id, norm); 10844 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 10845 if (!status) { 10846 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault"); 10847 return false; 10848 } 10849 10850 return detNormalizedStatImfileRowAlloc(det_id, iteration, class_id, norm, fault); 10767 10851 } 10768 10852 psArray *detNormalizedStatImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 10876 10960 static void detNormalizedImfileRowFree(detNormalizedImfileRow *object); 10877 10961 10878 detNormalizedImfileRow *detNormalizedImfileRowAlloc(psS32 det_id, psS32 iteration, const char *class_id, const char *uri, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri )10962 detNormalizedImfileRow *detNormalizedImfileRowAlloc(psS32 det_id, psS32 iteration, const char *class_id, const char *uri, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS16 fault) 10879 10963 { 10880 10964 detNormalizedImfileRow *_object; … … 10892 10976 _object->b1_uri = psStringCopy(b1_uri); 10893 10977 _object->b2_uri = psStringCopy(b2_uri); 10978 _object->fault = fault; 10894 10979 10895 10980 return _object; … … 10952 11037 return false; 10953 11038 } 11039 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) { 11040 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 11041 psFree(md); 11042 return false; 11043 } 10954 11044 10955 11045 bool status = psDBCreateTable(dbh, DETNORMALIZEDIMFILE_TABLE_NAME, md); … … 10965 11055 } 10966 11056 10967 bool detNormalizedImfileInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *class_id, const char *uri, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri )11057 bool detNormalizedImfileInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *class_id, const char *uri, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS16 fault) 10968 11058 { 10969 11059 psMetadata *md = psMetadataAlloc(); … … 11010 11100 if (!psMetadataAdd(md, PS_LIST_TAIL, "b2_uri", PS_DATA_STRING, NULL, b2_uri)) { 11011 11101 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 11102 psFree(md); 11103 return false; 11104 } 11105 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) { 11106 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 11012 11107 psFree(md); 11013 11108 return false; … … 11036 11131 bool detNormalizedImfileInsertObject(psDB *dbh, detNormalizedImfileRow *object) 11037 11132 { 11038 return detNormalizedImfileInsert(dbh, object->det_id, object->iteration, object->class_id, object->uri, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri );11133 return detNormalizedImfileInsert(dbh, object->det_id, object->iteration, object->class_id, object->uri, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri, object->fault); 11039 11134 } 11040 11135 … … 11154 11249 return false; 11155 11250 } 11251 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) { 11252 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 11253 psFree(md); 11254 return false; 11255 } 11156 11256 11157 11257 … … 11208 11308 return false; 11209 11309 } 11210 11211 return detNormalizedImfileRowAlloc(det_id, iteration, class_id, uri, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri); 11310 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 11311 if (!status) { 11312 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault"); 11313 return false; 11314 } 11315 11316 return detNormalizedImfileRowAlloc(det_id, iteration, class_id, uri, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri, fault); 11212 11317 } 11213 11318 psArray *detNormalizedImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 11321 11426 static void detNormalizedExpRowFree(detNormalizedExpRow *object); 11322 11427 11323 detNormalizedExpRow *detNormalizedExpRowAlloc(psS32 det_id, psS32 iteration, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri )11428 detNormalizedExpRow *detNormalizedExpRowAlloc(psS32 det_id, psS32 iteration, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS16 fault) 11324 11429 { 11325 11430 detNormalizedExpRow *_object; … … 11336 11441 _object->b1_uri = psStringCopy(b1_uri); 11337 11442 _object->b2_uri = psStringCopy(b2_uri); 11443 _object->fault = fault; 11338 11444 11339 11445 return _object; … … 11390 11496 return false; 11391 11497 } 11498 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) { 11499 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 11500 psFree(md); 11501 return false; 11502 } 11392 11503 11393 11504 bool status = psDBCreateTable(dbh, DETNORMALIZEDEXP_TABLE_NAME, md); … … 11403 11514 } 11404 11515 11405 bool detNormalizedExpInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri )11516 bool detNormalizedExpInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS16 fault) 11406 11517 { 11407 11518 psMetadata *md = psMetadataAlloc(); … … 11443 11554 if (!psMetadataAdd(md, PS_LIST_TAIL, "b2_uri", PS_DATA_STRING, NULL, b2_uri)) { 11444 11555 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 11556 psFree(md); 11557 return false; 11558 } 11559 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) { 11560 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 11445 11561 psFree(md); 11446 11562 return false; … … 11469 11585 bool detNormalizedExpInsertObject(psDB *dbh, detNormalizedExpRow *object) 11470 11586 { 11471 return detNormalizedExpInsert(dbh, object->det_id, object->iteration, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri );11587 return detNormalizedExpInsert(dbh, object->det_id, object->iteration, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri, object->fault); 11472 11588 } 11473 11589 … … 11582 11698 return false; 11583 11699 } 11700 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) { 11701 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 11702 psFree(md); 11703 return false; 11704 } 11584 11705 11585 11706 … … 11631 11752 return false; 11632 11753 } 11633 11634 return detNormalizedExpRowAlloc(det_id, iteration, recipe, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri); 11754 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 11755 if (!status) { 11756 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault"); 11757 return false; 11758 } 11759 11760 return detNormalizedExpRowAlloc(det_id, iteration, recipe, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri, fault); 11635 11761 } 11636 11762 psArray *detNormalizedExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 11744 11870 static void detResidImfileRowFree(detResidImfileRow *object); 11745 11871 11746 detResidImfileRow *detResidImfileRowAlloc(psS32 det_id, psS32 iteration, const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri )11872 detResidImfileRow *detResidImfileRowAlloc(psS32 det_id, psS32 iteration, const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS16 fault) 11747 11873 { 11748 11874 detResidImfileRow *_object; … … 11762 11888 _object->b1_uri = psStringCopy(b1_uri); 11763 11889 _object->b2_uri = psStringCopy(b2_uri); 11890 _object->fault = fault; 11764 11891 11765 11892 return _object; … … 11834 11961 return false; 11835 11962 } 11963 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) { 11964 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 11965 psFree(md); 11966 return false; 11967 } 11836 11968 11837 11969 bool status = psDBCreateTable(dbh, DETRESIDIMFILE_TABLE_NAME, md); … … 11847 11979 } 11848 11980 11849 bool detResidImfileInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri )11981 bool detResidImfileInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS16 fault) 11850 11982 { 11851 11983 psMetadata *md = psMetadataAlloc(); … … 11902 12034 if (!psMetadataAdd(md, PS_LIST_TAIL, "b2_uri", PS_DATA_STRING, NULL, b2_uri)) { 11903 12035 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 12036 psFree(md); 12037 return false; 12038 } 12039 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) { 12040 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 11904 12041 psFree(md); 11905 12042 return false; … … 11928 12065 bool detResidImfileInsertObject(psDB *dbh, detResidImfileRow *object) 11929 12066 { 11930 return detResidImfileInsert(dbh, object->det_id, object->iteration, object->exp_tag, object->class_id, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri );12067 return detResidImfileInsert(dbh, object->det_id, object->iteration, object->exp_tag, object->class_id, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri, object->fault); 11931 12068 } 11932 12069 … … 12056 12193 return false; 12057 12194 } 12195 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) { 12196 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 12197 psFree(md); 12198 return false; 12199 } 12058 12200 12059 12201 … … 12120 12262 return false; 12121 12263 } 12122 12123 return detResidImfileRowAlloc(det_id, iteration, exp_tag, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri); 12264 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 12265 if (!status) { 12266 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault"); 12267 return false; 12268 } 12269 12270 return detResidImfileRowAlloc(det_id, iteration, exp_tag, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri, fault); 12124 12271 } 12125 12272 psArray *detResidImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 12233 12380 static void detResidExpRowFree(detResidExpRow *object); 12234 12381 12235 detResidExpRow *detResidExpRowAlloc(psS32 det_id, psS32 iteration, const char *exp_tag, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, bool accept )12382 detResidExpRow *detResidExpRowAlloc(psS32 det_id, psS32 iteration, const char *exp_tag, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, bool accept, psS16 fault) 12236 12383 { 12237 12384 detResidExpRow *_object; … … 12250 12397 _object->b2_uri = psStringCopy(b2_uri); 12251 12398 _object->accept = accept; 12399 _object->fault = fault; 12252 12400 12253 12401 return _object; … … 12315 12463 return false; 12316 12464 } 12465 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) { 12466 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 12467 psFree(md); 12468 return false; 12469 } 12317 12470 12318 12471 bool status = psDBCreateTable(dbh, DETRESIDEXP_TABLE_NAME, md); … … 12328 12481 } 12329 12482 12330 bool detResidExpInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *exp_tag, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, bool accept )12483 bool detResidExpInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *exp_tag, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, bool accept, psS16 fault) 12331 12484 { 12332 12485 psMetadata *md = psMetadataAlloc(); … … 12378 12531 if (!psMetadataAdd(md, PS_LIST_TAIL, "accept", PS_DATA_BOOL, NULL, accept)) { 12379 12532 psError(PS_ERR_UNKNOWN, false, "failed to add item accept"); 12533 psFree(md); 12534 return false; 12535 } 12536 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) { 12537 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 12380 12538 psFree(md); 12381 12539 return false; … … 12404 12562 bool detResidExpInsertObject(psDB *dbh, detResidExpRow *object) 12405 12563 { 12406 return detResidExpInsert(dbh, object->det_id, object->iteration, object->exp_tag, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri, object->accept );12564 return detResidExpInsert(dbh, object->det_id, object->iteration, object->exp_tag, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri, object->accept, object->fault); 12407 12565 } 12408 12566 … … 12527 12685 return false; 12528 12686 } 12687 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) { 12688 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 12689 psFree(md); 12690 return false; 12691 } 12529 12692 12530 12693 … … 12586 12749 return false; 12587 12750 } 12588 12589 return detResidExpRowAlloc(det_id, iteration, exp_tag, recipe, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri, accept); 12751 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 12752 if (!status) { 12753 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault"); 12754 return false; 12755 } 12756 12757 return detResidExpRowAlloc(det_id, iteration, exp_tag, recipe, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri, accept, fault); 12590 12758 } 12591 12759 psArray *detResidExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 12699 12867 static void detRunSummaryRowFree(detRunSummaryRow *object); 12700 12868 12701 detRunSummaryRow *detRunSummaryRowAlloc(psS32 det_id, psS32 iteration, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, bool accept )12869 detRunSummaryRow *detRunSummaryRowAlloc(psS32 det_id, psS32 iteration, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, bool accept, psS16 fault) 12702 12870 { 12703 12871 detRunSummaryRow *_object; … … 12712 12880 _object->bg_mean_stdev = bg_mean_stdev; 12713 12881 _object->accept = accept; 12882 _object->fault = fault; 12714 12883 12715 12884 return _object; … … 12753 12922 return false; 12754 12923 } 12924 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) { 12925 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 12926 psFree(md); 12927 return false; 12928 } 12755 12929 12756 12930 bool status = psDBCreateTable(dbh, DETRUNSUMMARY_TABLE_NAME, md); … … 12766 12940 } 12767 12941 12768 bool detRunSummaryInsert(psDB * dbh, psS32 det_id, psS32 iteration, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, bool accept )12942 bool detRunSummaryInsert(psDB * dbh, psS32 det_id, psS32 iteration, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, bool accept, psS16 fault) 12769 12943 { 12770 12944 psMetadata *md = psMetadataAlloc(); … … 12796 12970 if (!psMetadataAdd(md, PS_LIST_TAIL, "accept", PS_DATA_BOOL, NULL, accept)) { 12797 12971 psError(PS_ERR_UNKNOWN, false, "failed to add item accept"); 12972 psFree(md); 12973 return false; 12974 } 12975 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) { 12976 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 12798 12977 psFree(md); 12799 12978 return false; … … 12822 13001 bool detRunSummaryInsertObject(psDB *dbh, detRunSummaryRow *object) 12823 13002 { 12824 return detRunSummaryInsert(dbh, object->det_id, object->iteration, object->bg, object->bg_stdev, object->bg_mean_stdev, object->accept );13003 return detRunSummaryInsert(dbh, object->det_id, object->iteration, object->bg, object->bg_stdev, object->bg_mean_stdev, object->accept, object->fault); 12825 13004 } 12826 13005 … … 12925 13104 return false; 12926 13105 } 13106 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) { 13107 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 13108 psFree(md); 13109 return false; 13110 } 12927 13111 12928 13112 … … 12964 13148 return false; 12965 13149 } 12966 12967 return detRunSummaryRowAlloc(det_id, iteration, bg, bg_stdev, bg_mean_stdev, accept); 13150 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 13151 if (!status) { 13152 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault"); 13153 return false; 13154 } 13155 13156 return detRunSummaryRowAlloc(det_id, iteration, bg, bg_stdev, bg_mean_stdev, accept, fault); 12968 13157 } 12969 13158 psArray *detRunSummarySelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Note:
See TracChangeset
for help on using the changeset viewer.
