Changeset 12177 for trunk/ippTools/src/regtool.c
- Timestamp:
- Mar 1, 2007, 5:47:00 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/regtool.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/regtool.c
r12174 r12177 27 27 #include "pxdata.h" 28 28 #include "regtool.h" 29 #include "chiptool.h" 29 30 30 31 static bool pendingimfileMode(pxConfig *config); … … 40 41 41 42 // static guidePendingExpRow *newToP1PendingExp(newExpRow *newExp); 42 static chipPendingExpRow *newTochipPendingExp(pxConfig *config, newExpRow *newExp);43 static chipPendingImfileRow *rawImfileTochipPendingImfile(pxConfig *config, psS64 chip_id, rawImfileRow *rawImfile);43 //static chipPendingExpRow *newTochipPendingExp(pxConfig *config, newExpRow *newExp); 44 //static chipPendingImfileRow *rawImfileTochipPendingImfile(pxConfig *config, psS64 chip_id, rawImfileRow *rawImfile); 44 45 45 46 static rawExpRow *newToRawExp(pxConfig *config, newExpRow *exp); … … 636 637 } 637 638 639 psFree(newExp); 640 638 641 // if this is a detrend image don't put it in the chip queue (and we're 639 642 // done) 640 643 if (detrend) { 641 psFree(newExp);642 644 continue; 643 645 } 644 646 645 647 // insert an entry into the chipPendingExp table 646 chipPendingExpRow *chipPendingExp = newTochipPendingExp(config, newExp); 647 if (!chipPendingExp) { 648 psError(PS_ERR_UNKNOWN, false, "failed to convert newExp to chipPendingExp"); 649 psFree(newExp); 650 psFree(output); 651 return false; 652 } 653 654 // insert the chipPendingExp object into the database 655 if (!chipPendingExpInsertObject(config->dbh, chipPendingExp)) { 648 if (!chipQueueRawExp(config, exp_tag, NULL, NULL, NULL, NULL)) { 656 649 // rollback 657 650 if (!psDBRollback(config->dbh)) { 658 651 psError(PS_ERR_UNKNOWN, false, "database error"); 659 652 } 660 psError(PS_ERR_UNKNOWN, false, "database error"); 661 psFree(chipPendingExp); 662 psFree(newExp); 653 psError(PS_ERR_UNKNOWN, false, "failed to queue chipPendingExp"); 663 654 psFree(output); 664 655 return false; 665 656 } 666 667 // get the chip_id for the imfiles668 psS64 chip_id = psDBLastInsertID(config->dbh);669 psFree(chipPendingExp);670 671 // find all of the rawImfiles associated with the chipPendingExp object672 psArray *rawImfiles = NULL;673 {674 // build a query to search by exp_tag675 psMetadata *where = psMetadataAlloc();676 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", newExp->exp_tag)) {677 // rollback678 if (!psDBRollback(config->dbh)) {679 psError(PS_ERR_UNKNOWN, false, "database error");680 }681 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");682 psFree(where);683 psFree(newExp);684 psFree(output);685 return false;686 }687 rawImfiles = rawImfileSelectRowObjects(config->dbh, where, 0);688 psFree(where);689 }690 // sanity check that least results were found691 if (!rawImfiles) {692 // rollback693 if (!psDBRollback(config->dbh)) {694 psError(PS_ERR_UNKNOWN, false, "database error");695 }696 psError(PS_ERR_UNKNOWN, false, "database error");697 psFree(newExp);698 psFree(output);699 return false;700 }701 // sanity check the number of rawImfiles found702 if (psArrayLength(rawImfiles) != newExp->imfiles) {703 // rollback704 if (!psDBRollback(config->dbh)) {705 psError(PS_ERR_UNKNOWN, false, "database error");706 }707 psError(PS_ERR_UNKNOWN, false, "found %ld rawImfiles but expected %d",708 psArrayLength(rawImfiles), newExp->imfiles);709 psFree(newExp);710 psFree(output);711 return false;712 }713 // convert the rawImfiles into chipPendingImfiles and insert them into714 // the database715 for (long i = 0; i < psArrayLength(rawImfiles); i++) {716 rawImfileRow *rawImfile = rawImfiles->data[i];717 chipPendingImfileRow *pendingImfile = rawImfileTochipPendingImfile(config, chip_id, rawImfile);718 if (!chipPendingImfileInsertObject(config->dbh, pendingImfile)){719 // rollback720 if (!psDBRollback(config->dbh)) {721 psError(PS_ERR_UNKNOWN, false, "database error");722 }723 psError(PS_ERR_UNKNOWN, false, "database error");724 psFree(pendingImfile);725 psFree(rawImfiles);726 psFree(newExp);727 psFree(output);728 }729 psFree(pendingImfile);730 }731 psFree(rawImfiles);732 psFree(newExp);733 657 } 734 658 … … 879 803 880 804 805 #if 0 881 806 static chipPendingExpRow *newTochipPendingExp(pxConfig *config, newExpRow *exp) 882 807 { … … 914 839 ); 915 840 } 841 #endif 916 842 917 843
Note:
See TracChangeset
for help on using the changeset viewer.
