Changeset 9213
- Timestamp:
- Oct 4, 2006, 11:22:25 AM (20 years ago)
- Location:
- trunk/ippdb
- Files:
-
- 9 edited
-
configure.ac (modified) (1 diff)
-
src/ippdb.c (modified) (20 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
-
trunk/ippdb/configure.ac
r9187 r9213 7 7 AC_PREREQ(2.59) 8 8 9 AC_INIT([ippdb], [0.0.4 3], [pan-starrs.ifa.hawaii.edu])9 AC_INIT([ippdb], [0.0.44], [pan-starrs.ifa.hawaii.edu]) 10 10 AC_CONFIG_SRCDIR([ippdb.pc.in]) 11 11 -
trunk/ippdb/src/ippdb.c
r9187 r9213 11815 11815 return false; 11816 11816 } 11817 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, " 64")) {11817 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "255")) { 11818 11818 psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri"); 11819 11819 psFree(md); 11820 11820 return false; 11821 11821 } 11822 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, " 64")) {11822 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "255")) { 11823 11823 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 11824 11824 psFree(md); … … 13858 13858 return false; 13859 13859 } 13860 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, " 64")) {13860 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "255")) { 13861 13861 psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri"); 13862 13862 psFree(md); 13863 13863 return false; 13864 13864 } 13865 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, " 64")) {13865 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "255")) { 13866 13866 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 13867 13867 psFree(md); … … 14495 14495 return false; 14496 14496 } 14497 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, " 64")) {14497 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "255")) { 14498 14498 psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri"); 14499 14499 psFree(md); 14500 14500 return false; 14501 14501 } 14502 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, " 64")) {14502 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "255")) { 14503 14503 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 14504 14504 psFree(md); … … 16080 16080 static void detNormalizedImfileRowFree(detNormalizedImfileRow *object); 16081 16081 16082 detNormalizedImfileRow *detNormalizedImfileRowAlloc(psS32 det_id, psS32 iteration, const char *class_id, const char *uri )16082 detNormalizedImfileRow *detNormalizedImfileRowAlloc(psS32 det_id, psS32 iteration, const char *class_id, const char *uri, const char *b1_uri, const char *b2_uri) 16083 16083 { 16084 16084 detNormalizedImfileRow *object; … … 16091 16091 object->class_id = psStringCopy(class_id); 16092 16092 object->uri = psStringCopy(uri); 16093 object->b1_uri = psStringCopy(b1_uri); 16094 object->b2_uri = psStringCopy(b2_uri); 16093 16095 16094 16096 return object; … … 16099 16101 psFree(object->class_id); 16100 16102 psFree(object->uri); 16103 psFree(object->b1_uri); 16104 psFree(object->b2_uri); 16101 16105 } 16102 16106 … … 16132 16136 return false; 16133 16137 } 16138 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "255")) { 16139 psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri"); 16140 psFree(md); 16141 return false; 16142 } 16143 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "255")) { 16144 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 16145 psFree(md); 16146 return false; 16147 } 16134 16148 16135 16149 status = psDBCreateTable(dbh, DETNORMALIZEDIMFILE_TABLE_NAME, md); … … 16145 16159 } 16146 16160 16147 bool detNormalizedImfileInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *class_id, const char *uri )16161 bool detNormalizedImfileInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *class_id, const char *uri, const char *b1_uri, const char *b2_uri) 16148 16162 { 16149 16163 psMetadata *md; … … 16168 16182 if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, uri)) { 16169 16183 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); 16184 psFree(md); 16185 return false; 16186 } 16187 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, b1_uri)) { 16188 psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri"); 16189 psFree(md); 16190 return false; 16191 } 16192 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, b2_uri)) { 16193 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 16170 16194 psFree(md); 16171 16195 return false; … … 16192 16216 return deleted; 16193 16217 } 16194 bool detNormalizedImfilePop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **class_id, char **uri )16218 bool detNormalizedImfilePop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **class_id, char **uri, char **b1_uri, char **b2_uri) 16195 16219 { 16196 16220 psArray *rowSet; … … 16260 16284 return false; 16261 16285 } 16286 *b1_uri = psMetadataLookupPtr(&status, row, "b1_uri"); 16287 if (!status) { 16288 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b1_uri"); 16289 psFree(row); 16290 return false; 16291 } 16292 *b2_uri = psMetadataLookupPtr(&status, row, "b2_uri"); 16293 if (!status) { 16294 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b2_uri"); 16295 psFree(row); 16296 return false; 16297 } 16262 16298 16263 16299 psFree(row); … … 16268 16304 bool detNormalizedImfileInsertObject(psDB *dbh, detNormalizedImfileRow *object) 16269 16305 { 16270 return detNormalizedImfileInsert(dbh, object->det_id, object->iteration, object->class_id, object->uri );16306 return detNormalizedImfileInsert(dbh, object->det_id, object->iteration, object->class_id, object->uri, object->b1_uri, object->b2_uri); 16271 16307 } 16272 16308 … … 16288 16324 char class_id[256]; 16289 16325 char uri[256]; 16290 16291 if (!detNormalizedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri)) { 16326 char b1_uri[256]; 16327 char b2_uri[256]; 16328 16329 if (!detNormalizedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri, (char **)&b1_uri, (char **)&b2_uri)) { 16292 16330 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 16293 16331 return NULL; 16294 16332 } 16295 16333 16296 return detNormalizedImfileRowAlloc(det_id, iteration, class_id, uri );16334 return detNormalizedImfileRowAlloc(det_id, iteration, class_id, uri, b1_uri, b2_uri); 16297 16335 } 16298 16336 … … 16413 16451 return NULL; 16414 16452 } 16453 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, object->b1_uri)) { 16454 psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri"); 16455 psFree(md); 16456 return NULL; 16457 } 16458 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, object->b2_uri)) { 16459 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 16460 psFree(md); 16461 return NULL; 16462 } 16415 16463 16416 16464 return md; … … 16424 16472 char *class_id; 16425 16473 char *uri; 16474 char *b1_uri; 16475 char *b2_uri; 16426 16476 16427 16477 det_id = psMetadataLookupS32(&status, md, "det_id"); … … 16445 16495 return false; 16446 16496 } 16447 16448 return detNormalizedImfileRowAlloc(det_id, iteration, class_id, uri); 16497 b1_uri = psMetadataLookupPtr(&status, md, "b1_uri"); 16498 if (!status) { 16499 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b1_uri"); 16500 return false; 16501 } 16502 b2_uri = psMetadataLookupPtr(&status, md, "b2_uri"); 16503 if (!status) { 16504 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b2_uri"); 16505 return false; 16506 } 16507 16508 return detNormalizedImfileRowAlloc(det_id, iteration, class_id, uri, b1_uri, b2_uri); 16449 16509 } 16450 16510 psArray *detNormalizedImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 16620 16680 return false; 16621 16681 } 16622 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, " 64")) {16682 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "255")) { 16623 16683 psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri"); 16624 16684 psFree(md); 16625 16685 return false; 16626 16686 } 16627 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, " 64")) {16687 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "255")) { 16628 16688 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 16629 16689 psFree(md); … … 18123 18183 return false; 18124 18184 } 18125 if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, " 64")) {18185 if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, "255")) { 18126 18186 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); 18127 18187 psFree(md); … … 18148 18208 return false; 18149 18209 } 18150 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, " 64")) {18210 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "255")) { 18151 18211 psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri"); 18152 18212 psFree(md); 18153 18213 return false; 18154 18214 } 18155 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, " 64")) {18215 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "255")) { 18156 18216 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 18157 18217 psFree(md); … … 18815 18875 return false; 18816 18876 } 18817 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, " 64")) {18877 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "255")) { 18818 18878 psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri"); 18819 18879 psFree(md); 18820 18880 return false; 18821 18881 } 18822 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, " 64")) {18882 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "255")) { 18823 18883 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 18824 18884 psFree(md); -
trunk/ippdb/src/ippdb.h
r9187 r9213 6823 6823 char *class_id; 6824 6824 char *uri; 6825 char *b1_uri; 6826 char *b2_uri; 6825 6827 } detNormalizedImfileRow; 6826 6828 … … 6834 6836 psS32 iteration, 6835 6837 const char *class_id, 6836 const char *uri 6838 const char *uri, 6839 const char *b1_uri, 6840 const char *b2_uri 6837 6841 ); 6838 6842 … … 6867 6871 psS32 iteration, 6868 6872 const char *class_id, 6869 const char *uri 6873 const char *uri, 6874 const char *b1_uri, 6875 const char *b2_uri 6870 6876 ); 6871 6877 … … 6891 6897 psS32 *iteration, 6892 6898 char **class_id, 6893 char **uri 6899 char **uri, 6900 char **b1_uri, 6901 char **b2_uri 6894 6902 ); 6895 6903 -
trunk/ippdb/tests/alloc.c
r9187 r9213 1175 1175 detNormalizedImfileRow *object; 1176 1176 1177 object = detNormalizedImfileRowAlloc(-32, -32, "a string", "a string" );1177 object = detNormalizedImfileRowAlloc(-32, -32, "a string", "a string", "a string", "a string" ); 1178 1178 1179 1179 if (!object) { … … 1194 1194 } 1195 1195 if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) { 1196 psFree(object); 1197 exit(EXIT_FAILURE); 1198 } 1199 if (strncmp(object->b1_uri, "a string", MAX_STRING_LENGTH)) { 1200 psFree(object); 1201 exit(EXIT_FAILURE); 1202 } 1203 if (strncmp(object->b2_uri, "a string", MAX_STRING_LENGTH)) { 1196 1204 psFree(object); 1197 1205 exit(EXIT_FAILURE); -
trunk/ippdb/tests/insert.c
r9187 r9213 433 433 } 434 434 435 if (!detNormalizedImfileInsert(dbh, -32, -32, "a string", "a string" )) {435 if (!detNormalizedImfileInsert(dbh, -32, -32, "a string", "a string", "a string", "a string")) { 436 436 exit(EXIT_FAILURE); 437 437 } -
trunk/ippdb/tests/insertobject.c
r9187 r9213 630 630 } 631 631 632 object = detNormalizedImfileRowAlloc(-32, -32, "a string", "a string" );632 object = detNormalizedImfileRowAlloc(-32, -32, "a string", "a string", "a string", "a string"); 633 633 if (!object) { 634 634 exit(EXIT_FAILURE); -
trunk/ippdb/tests/metadatafromobject.c
r9187 r9213 1401 1401 bool status; 1402 1402 1403 object = detNormalizedImfileRowAlloc(-32, -32, "a string", "a string" );1403 object = detNormalizedImfileRowAlloc(-32, -32, "a string", "a string", "a string", "a string"); 1404 1404 if (!object) { 1405 1405 exit(EXIT_FAILURE); … … 1426 1426 } 1427 1427 if (strncmp(psMetadataLookupPtr(&status, md, "uri"), "a string", MAX_STRING_LENGTH)) { 1428 psFree(md); 1429 exit(EXIT_FAILURE); 1430 } 1431 if (strncmp(psMetadataLookupPtr(&status, md, "b1_uri"), "a string", MAX_STRING_LENGTH)) { 1432 psFree(md); 1433 exit(EXIT_FAILURE); 1434 } 1435 if (strncmp(psMetadataLookupPtr(&status, md, "b2_uri"), "a string", MAX_STRING_LENGTH)) { 1428 1436 psFree(md); 1429 1437 exit(EXIT_FAILURE); -
trunk/ippdb/tests/objectfrommetadata.c
r9187 r9213 2133 2133 exit(EXIT_FAILURE); 2134 2134 } 2135 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "a string")) { 2136 psFree(md); 2137 exit(EXIT_FAILURE); 2138 } 2139 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "a string")) { 2140 psFree(md); 2141 exit(EXIT_FAILURE); 2142 } 2135 2143 2136 2144 object = detNormalizedImfileObjectFromMetadata(md); … … 2155 2163 } 2156 2164 if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) { 2165 psFree(object); 2166 exit(EXIT_FAILURE); 2167 } 2168 if (strncmp(object->b1_uri, "a string", MAX_STRING_LENGTH)) { 2169 psFree(object); 2170 exit(EXIT_FAILURE); 2171 } 2172 if (strncmp(object->b2_uri, "a string", MAX_STRING_LENGTH)) { 2157 2173 psFree(object); 2158 2174 exit(EXIT_FAILURE); -
trunk/ippdb/tests/pop.c
r9187 r9213 631 631 char class_id[256]; 632 632 char uri[256]; 633 634 dbh = psDBInit("localhost", "test", NULL, "test"); 635 if (!dbh) { 636 exit(EXIT_FAILURE); 637 } 638 639 if (!detNormalizedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri)) { 633 char b1_uri[256]; 634 char b2_uri[256]; 635 636 dbh = psDBInit("localhost", "test", NULL, "test"); 637 if (!dbh) { 638 exit(EXIT_FAILURE); 639 } 640 641 if (!detNormalizedImfilePop(dbh, &det_id, &iteration, (char **)&class_id, (char **)&uri, (char **)&b1_uri, (char **)&b2_uri)) { 640 642 exit(EXIT_FAILURE); 641 643 }
Note:
See TracChangeset
for help on using the changeset viewer.
