Changeset 12188 for trunk/ippTools/src/chiptool.c
- Timestamp:
- Mar 2, 2007, 12:42:55 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/chiptool.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/chiptool.c
r12184 r12188 29 29 #include "pxdata.h" 30 30 #include "chiptool.h" 31 #include "camtool.h" 31 32 32 33 static bool queuerawexpMode(pxConfig *config); … … 41 42 static chipProcessedImfileRow *chipPendingToProcessedImfile(pxConfig *config, chipPendingImfileRow *imfile); 42 43 static chipProcessedExpRow *chipPendingToProcessedExp(pxConfig *config, chipPendingExpRow *pendingExp); 43 static camPendingExpRow *chipPendingTocamPendingExp(pxConfig *config, chipPendingExpRow *pendingExp);44 44 static bool chipProcessedCompleteExp(pxConfig *config); 45 45 … … 748 748 for (long i = 0; i < psArrayLength(output); i++) { 749 749 psMetadata *row = output->data[i]; 750 750 751 // convert metadata into a chipPendingExp object 751 chipPendingExpRow *object = chipPendingExpObjectFromMetadata(row); 752 // do both *Exp type conversion first so we don't insert one and then 753 // have to rollback the change as the 2nd failed 752 chipPendingExpRow *pendingExp = chipPendingExpObjectFromMetadata(row); 753 if (!pendingExp) { 754 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into chipPendingExp"); 755 psFree(output); 756 return false; 757 } 758 754 759 // convert chipPendingExp object into a chipProcesseExp object 755 chipProcessedExpRow *processedExp = chipPendingToProcessedExp(config, object);760 chipProcessedExpRow *processedExp = chipPendingToProcessedExp(config, pendingExp); 756 761 if (!processedExp) { 757 762 psError(PS_ERR_UNKNOWN, false, "failed to convert chipPendingExp to chipProcessedExp"); 758 psFree(object); 759 psFree(output); 760 return false; 761 } 762 // convert chipPendingExp object into a camPendingExp object 763 camPendingExpRow *pendingExp = chipPendingTocamPendingExp(config, object); 764 if (!processedExp) { 765 psError(PS_ERR_UNKNOWN, false, "failed to convert chipPendingExp to camPendingExp"); 763 psFree(pendingExp); 764 psFree(output); 765 return false; 766 } 767 768 // delete the chipPendingExp object from the database 769 if (!chipPendingExpDeleteObject(config->dbh, pendingExp)) { 770 // there must be atleast 1 Imfile to get this far 771 psError(PS_ERR_UNKNOWN, false, "database error"); 766 772 psFree(processedExp); 767 psFree(object); 768 psFree(output); 769 return false; 770 } 773 psFree(pendingExp); 774 psFree(output); 775 return false; 776 } 777 psFree(pendingExp); 778 771 779 // insert chipProccessedExp object into the database 772 780 if (!chipProcessedExpInsertObject(config->dbh, processedExp)) { 773 781 psError(PS_ERR_UNKNOWN, false, "database error"); 774 782 psFree(processedExp); 775 psFree(pendingExp); 776 psFree(object); 777 psFree(output); 778 return false; 779 } 783 psFree(output); 784 return false; 785 } 786 787 // camQueueChipID() can only be run after the chipProcessedExp entry 788 // has been inserted. 789 // queue the chip_id in the camPendingExp table 790 if (!camQueueChipID(config, 791 processedExp->chip_id, 792 processedExp->label, 793 processedExp->recipe, 794 processedExp->expgroup, 795 processedExp->dvodb 796 )) { 797 // rollback 798 if (!psDBRollback(config->dbh)) { 799 psError(PS_ERR_UNKNOWN, false, "database error"); 800 } 801 psError(PS_ERR_UNKNOWN, false, "failed to queue camPendingExp"); 802 psFree(processedExp); 803 psFree(output); 804 return false; 805 } 806 780 807 psFree(processedExp); 781 // insert camPendingExp object into the database782 if (!camPendingExpInsertObject(config->dbh, pendingExp)) {783 psError(PS_ERR_UNKNOWN, false, "database error");784 psFree(pendingExp);785 psFree(object);786 psFree(output);787 return false;788 }789 psFree(pendingExp);790 // delete the chipPendingExp object from the database791 if (!chipPendingExpDeleteObject(config->dbh, object)) {792 // there must be atleast 1 Imfile to get this far793 psError(PS_ERR_UNKNOWN, false, "database error");794 psFree(object);795 psFree(output);796 return false;797 }798 psFree(object);799 808 } 800 809 … … 875 884 pendingExp->guide_id, 876 885 pendingExp->label, 886 pendingExp->recipe, 877 887 pendingExp->expgroup, 878 888 pendingExp->dvodb 879 889 ); 880 890 } 881 882 883 static camPendingExpRow *chipPendingTocamPendingExp(pxConfig *config, chipPendingExpRow *pendingExp)884 {885 PS_ASSERT_PTR_NON_NULL(pendingExp, NULL);886 887 return camPendingExpRowAlloc(888 0, // cam version, assigned by db889 pendingExp->chip_id,890 pendingExp->label,891 pendingExp->expgroup,892 pendingExp->dvodb893 );894 }
Note:
See TracChangeset
for help on using the changeset viewer.
