Changeset 8148
- Timestamp:
- Aug 4, 2006, 1:04:56 PM (20 years ago)
- Location:
- branches/jhoblitt/ippdb
- Files:
-
- 9 edited
-
configure.ac (modified) (1 diff)
-
src/ippdb.c (modified) (13 diffs)
-
src/ippdb.h (modified) (4 diffs)
-
tests/alloc.c (modified) (2 diffs)
-
tests/insert.c (modified) (1 diff)
-
tests/insertobject.c (modified) (1 diff)
-
tests/metadatafromobject.c (modified) (2 diffs)
-
tests/objectfrommetadata.c (modified) (2 diffs)
-
tests/pop.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/jhoblitt/ippdb/configure.ac
r8122 r8148 1 1 AC_PREREQ(2.59) 2 2 3 AC_INIT([ippdb], [0.0.1 2], [pan-starrs.ifa.hawaii.edu])3 AC_INIT([ippdb], [0.0.13], [pan-starrs.ifa.hawaii.edu]) 4 4 AC_CONFIG_SRCDIR([ippdb.pc.in]) 5 5 -
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) -
branches/jhoblitt/ippdb/src/ippdb.h
r8122 r8148 5908 5908 char *class_id; 5909 5909 char *recipe; 5910 char *uri; 5911 char *b1_uri; 5912 char *b2_uri; 5910 5913 } detResidImfileAnalysisRow; 5911 5914 … … 5920 5923 const char *exp_id, 5921 5924 const char *class_id, 5922 const char *recipe 5925 const char *recipe, 5926 const char *uri, 5927 const char *b1_uri, 5928 const char *b2_uri 5923 5929 ); 5924 5930 … … 5954 5960 const char *exp_id, 5955 5961 const char *class_id, 5956 const char *recipe 5962 const char *recipe, 5963 const char *uri, 5964 const char *b1_uri, 5965 const char *b2_uri 5957 5966 ); 5958 5967 … … 5979 5988 char **exp_id, 5980 5989 char **class_id, 5981 char **recipe 5990 char **recipe, 5991 char **uri, 5992 char **b1_uri, 5993 char **b2_uri 5982 5994 ); 5983 5995 -
branches/jhoblitt/ippdb/tests/alloc.c
r8103 r8148 1207 1207 detResidImfileAnalysisRow *object; 1208 1208 1209 object = detResidImfileAnalysisRowAlloc(-32, -32, "a string", "a string", "a string" );1209 object = detResidImfileAnalysisRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string" ); 1210 1210 1211 1211 if (!object) { … … 1230 1230 } 1231 1231 if (strncmp(object->recipe, "a string", MAX_STRING_LENGTH)) { 1232 psFree(object); 1233 exit(EXIT_FAILURE); 1234 } 1235 if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) { 1236 psFree(object); 1237 exit(EXIT_FAILURE); 1238 } 1239 if (strncmp(object->b1_uri, "a string", MAX_STRING_LENGTH)) { 1240 psFree(object); 1241 exit(EXIT_FAILURE); 1242 } 1243 if (strncmp(object->b2_uri, "a string", MAX_STRING_LENGTH)) { 1232 1244 psFree(object); 1233 1245 exit(EXIT_FAILURE); -
branches/jhoblitt/ippdb/tests/insert.c
r8094 r8148 448 448 } 449 449 450 if (!detResidImfileAnalysisInsert(dbh, -32, -32, "a string", "a string", "a string" )) {450 if (!detResidImfileAnalysisInsert(dbh, -32, -32, "a string", "a string", "a string", "a string", "a string", "a string")) { 451 451 exit(EXIT_FAILURE); 452 452 } -
branches/jhoblitt/ippdb/tests/insertobject.c
r8094 r8148 652 652 } 653 653 654 object = detResidImfileAnalysisRowAlloc(-32, -32, "a string", "a string", "a string" );654 object = detResidImfileAnalysisRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string"); 655 655 if (!object) { 656 656 exit(EXIT_FAILURE); -
branches/jhoblitt/ippdb/tests/metadatafromobject.c
r8103 r8148 1442 1442 bool status; 1443 1443 1444 object = detResidImfileAnalysisRowAlloc(-32, -32, "a string", "a string", "a string" );1444 object = detResidImfileAnalysisRowAlloc(-32, -32, "a string", "a string", "a string", "a string", "a string", "a string"); 1445 1445 if (!object) { 1446 1446 exit(EXIT_FAILURE); … … 1471 1471 } 1472 1472 if (strncmp(psMetadataLookupPtr(&status, md, "recipe"), "a string", MAX_STRING_LENGTH)) { 1473 psFree(md); 1474 exit(EXIT_FAILURE); 1475 } 1476 if (strncmp(psMetadataLookupPtr(&status, md, "uri"), "a string", MAX_STRING_LENGTH)) { 1477 psFree(md); 1478 exit(EXIT_FAILURE); 1479 } 1480 if (strncmp(psMetadataLookupPtr(&status, md, "b1_uri"), "a string", MAX_STRING_LENGTH)) { 1481 psFree(md); 1482 exit(EXIT_FAILURE); 1483 } 1484 if (strncmp(psMetadataLookupPtr(&status, md, "b2_uri"), "a string", MAX_STRING_LENGTH)) { 1473 1485 psFree(md); 1474 1486 exit(EXIT_FAILURE); -
branches/jhoblitt/ippdb/tests/objectfrommetadata.c
r8103 r8148 2195 2195 exit(EXIT_FAILURE); 2196 2196 } 2197 if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, "a string")) { 2198 psFree(md); 2199 exit(EXIT_FAILURE); 2200 } 2201 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "a string")) { 2202 psFree(md); 2203 exit(EXIT_FAILURE); 2204 } 2205 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "a string")) { 2206 psFree(md); 2207 exit(EXIT_FAILURE); 2208 } 2197 2209 2198 2210 object = detResidImfileAnalysisObjectFromMetadata(md); … … 2221 2233 } 2222 2234 if (strncmp(object->recipe, "a string", MAX_STRING_LENGTH)) { 2235 psFree(object); 2236 exit(EXIT_FAILURE); 2237 } 2238 if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) { 2239 psFree(object); 2240 exit(EXIT_FAILURE); 2241 } 2242 if (strncmp(object->b1_uri, "a string", MAX_STRING_LENGTH)) { 2243 psFree(object); 2244 exit(EXIT_FAILURE); 2245 } 2246 if (strncmp(object->b2_uri, "a string", MAX_STRING_LENGTH)) { 2223 2247 psFree(object); 2224 2248 exit(EXIT_FAILURE); -
branches/jhoblitt/ippdb/tests/pop.c
r8103 r8148 652 652 char class_id[256]; 653 653 char recipe[256]; 654 655 dbh = psDBInit("localhost", "test", NULL, "test"); 656 if (!dbh) { 657 exit(EXIT_FAILURE); 658 } 659 660 if (!detResidImfileAnalysisPop(dbh, &det_id, &iteration, (char **)&exp_id, (char **)&class_id, (char **)&recipe)) { 654 char uri[256]; 655 char b1_uri[256]; 656 char b2_uri[256]; 657 658 dbh = psDBInit("localhost", "test", NULL, "test"); 659 if (!dbh) { 660 exit(EXIT_FAILURE); 661 } 662 663 if (!detResidImfileAnalysisPop(dbh, &det_id, &iteration, (char **)&exp_id, (char **)&class_id, (char **)&recipe, (char **)&uri, (char **)&b1_uri, (char **)&b2_uri)) { 661 664 exit(EXIT_FAILURE); 662 665 }
Note:
See TracChangeset
for help on using the changeset viewer.
