Changeset 8148 for branches/jhoblitt/ippdb/src/ippdb.c
- Timestamp:
- Aug 4, 2006, 1:04:56 PM (20 years ago)
- File:
-
- 1 edited
-
branches/jhoblitt/ippdb/src/ippdb.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/jhoblitt/ippdb/src/ippdb.c
r8122 r8148 14669 14669 static void detResidImfileAnalysisRowFree(detResidImfileAnalysisRow *object); 14670 14670 14671 detResidImfileAnalysisRow *detResidImfileAnalysisRowAlloc(psS32 det_id, psS32 iteration, const char *exp_id, const char *class_id, const char *recipe )14671 detResidImfileAnalysisRow *detResidImfileAnalysisRowAlloc(psS32 det_id, psS32 iteration, const char *exp_id, const char *class_id, const char *recipe, const char *uri, const char *b1_uri, const char *b2_uri) 14672 14672 { 14673 14673 detResidImfileAnalysisRow *object; … … 14681 14681 object->class_id = psStringCopy(class_id); 14682 14682 object->recipe = psStringCopy(recipe); 14683 object->uri = psStringCopy(uri); 14684 object->b1_uri = psStringCopy(b1_uri); 14685 object->b2_uri = psStringCopy(b2_uri); 14683 14686 14684 14687 return object; … … 14690 14693 psFree(object->class_id); 14691 14694 psFree(object->recipe); 14695 psFree(object->uri); 14696 psFree(object->b1_uri); 14697 psFree(object->b2_uri); 14692 14698 } 14693 14699 … … 14728 14734 return false; 14729 14735 } 14736 if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, "64")) { 14737 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); 14738 psFree(md); 14739 return false; 14740 } 14741 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "64")) { 14742 psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri"); 14743 psFree(md); 14744 return false; 14745 } 14746 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "64")) { 14747 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 14748 psFree(md); 14749 return false; 14750 } 14730 14751 14731 14752 status = psDBCreateTable(dbh, DETRESIDIMFILEANALYSIS_TABLE_NAME, md); … … 14741 14762 } 14742 14763 14743 bool detResidImfileAnalysisInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *exp_id, const char *class_id, const char *recipe )14764 bool detResidImfileAnalysisInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *exp_id, const char *class_id, const char *recipe, const char *uri, const char *b1_uri, const char *b2_uri) 14744 14765 { 14745 14766 psMetadata *md; … … 14769 14790 if (!psMetadataAddStr(md, PS_LIST_TAIL, "recipe", 0, NULL, recipe)) { 14770 14791 psError(PS_ERR_UNKNOWN, false, "failed to add item recipe"); 14792 psFree(md); 14793 return false; 14794 } 14795 if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, uri)) { 14796 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); 14797 psFree(md); 14798 return false; 14799 } 14800 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, b1_uri)) { 14801 psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri"); 14802 psFree(md); 14803 return false; 14804 } 14805 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, b2_uri)) { 14806 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 14771 14807 psFree(md); 14772 14808 return false; … … 14793 14829 return deleted; 14794 14830 } 14795 bool detResidImfileAnalysisPop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **exp_id, char **class_id, char **recipe )14831 bool detResidImfileAnalysisPop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **exp_id, char **class_id, char **recipe, char **uri, char **b1_uri, char **b2_uri) 14796 14832 { 14797 14833 psArray *rowSet; … … 14867 14903 return false; 14868 14904 } 14905 *uri = psMetadataLookupPtr(&status, row, "uri"); 14906 if (!status) { 14907 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item uri"); 14908 psFree(row); 14909 return false; 14910 } 14911 *b1_uri = psMetadataLookupPtr(&status, row, "b1_uri"); 14912 if (!status) { 14913 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b1_uri"); 14914 psFree(row); 14915 return false; 14916 } 14917 *b2_uri = psMetadataLookupPtr(&status, row, "b2_uri"); 14918 if (!status) { 14919 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b2_uri"); 14920 psFree(row); 14921 return false; 14922 } 14869 14923 14870 14924 psFree(row); … … 14875 14929 bool detResidImfileAnalysisInsertObject(psDB *dbh, detResidImfileAnalysisRow *object) 14876 14930 { 14877 return detResidImfileAnalysisInsert(dbh, object->det_id, object->iteration, object->exp_id, object->class_id, object->recipe );14931 return detResidImfileAnalysisInsert(dbh, object->det_id, object->iteration, object->exp_id, object->class_id, object->recipe, object->uri, object->b1_uri, object->b2_uri); 14878 14932 } 14879 14933 … … 14885 14939 char class_id[256]; 14886 14940 char recipe[256]; 14887 14888 if (!detResidImfileAnalysisPop(dbh, &det_id, &iteration, (char **)&exp_id, (char **)&class_id, (char **)&recipe)) { 14941 char uri[256]; 14942 char b1_uri[256]; 14943 char b2_uri[256]; 14944 14945 if (!detResidImfileAnalysisPop(dbh, &det_id, &iteration, (char **)&exp_id, (char **)&class_id, (char **)&recipe, (char **)&uri, (char **)&b1_uri, (char **)&b2_uri)) { 14889 14946 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 14890 14947 return NULL; 14891 14948 } 14892 14949 14893 return detResidImfileAnalysisRowAlloc(det_id, iteration, exp_id, class_id, recipe );14950 return detResidImfileAnalysisRowAlloc(det_id, iteration, exp_id, class_id, recipe, uri, b1_uri, b2_uri); 14894 14951 } 14895 14952 … … 15015 15072 return NULL; 15016 15073 } 15074 if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, object->uri)) { 15075 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); 15076 psFree(md); 15077 return NULL; 15078 } 15079 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, object->b1_uri)) { 15080 psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri"); 15081 psFree(md); 15082 return NULL; 15083 } 15084 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, object->b2_uri)) { 15085 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 15086 psFree(md); 15087 return NULL; 15088 } 15017 15089 15018 15090 return md; … … 15027 15099 char *class_id; 15028 15100 char *recipe; 15101 char *uri; 15102 char *b1_uri; 15103 char *b2_uri; 15029 15104 15030 15105 det_id = psMetadataLookupS32(&status, md, "det_id"); … … 15053 15128 return false; 15054 15129 } 15055 15056 return detResidImfileAnalysisRowAlloc(det_id, iteration, exp_id, class_id, recipe); 15130 uri = psMetadataLookupPtr(&status, md, "uri"); 15131 if (!status) { 15132 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item uri"); 15133 return false; 15134 } 15135 b1_uri = psMetadataLookupPtr(&status, md, "b1_uri"); 15136 if (!status) { 15137 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b1_uri"); 15138 return false; 15139 } 15140 b2_uri = psMetadataLookupPtr(&status, md, "b2_uri"); 15141 if (!status) { 15142 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b2_uri"); 15143 return false; 15144 } 15145 15146 return detResidImfileAnalysisRowAlloc(det_id, iteration, exp_id, class_id, recipe, uri, b1_uri, b2_uri); 15057 15147 } 15058 15148 psArray *detResidImfileAnalysisSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Note:
See TracChangeset
for help on using the changeset viewer.
