Changeset 15003
- Timestamp:
- Sep 24, 2007, 6:18:00 PM (19 years ago)
- Location:
- trunk/ippdb
- Files:
-
- 7 edited
-
src/ippdb.c (modified) (8 diffs)
-
src/ippdb.h (modified) (3 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)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/src/ippdb.c
r14598 r15003 19293 19293 static void magicInputSkyfileRowFree(magicInputSkyfileRow *object); 19294 19294 19295 magicInputSkyfileRow *magicInputSkyfileRowAlloc(psS64 magic_id, psS64 diff_id, psS32node)19295 magicInputSkyfileRow *magicInputSkyfileRowAlloc(psS64 magic_id, psS64 diff_id, const char *node) 19296 19296 { 19297 19297 magicInputSkyfileRow *_object; … … 19302 19302 _object->magic_id = magic_id; 19303 19303 _object->diff_id = diff_id; 19304 _object->node = node;19304 _object->node = psStringCopy(node); 19305 19305 19306 19306 return _object; … … 19309 19309 static void magicInputSkyfileRowFree(magicInputSkyfileRow *object) 19310 19310 { 19311 psFree(object->node); 19311 19312 } 19312 19313 … … 19324 19325 return false; 19325 19326 } 19326 if (!psMetadataAdd(md, PS_LIST_TAIL, "node", PS_DATA_S 32, "AUTO_INCREMENT INDEX(magic_id, node)", 0)) {19327 if (!psMetadataAdd(md, PS_LIST_TAIL, "node", PS_DATA_STRING, "INDEX(magic_id, node)", "64")) { 19327 19328 psError(PS_ERR_UNKNOWN, false, "failed to add item node"); 19328 19329 psFree(md); … … 19342 19343 } 19343 19344 19344 bool magicInputSkyfileInsert(psDB * dbh, psS64 magic_id, psS64 diff_id, psS32node)19345 bool magicInputSkyfileInsert(psDB * dbh, psS64 magic_id, psS64 diff_id, const char *node) 19345 19346 { 19346 19347 psMetadata *md = psMetadataAlloc(); … … 19355 19356 return false; 19356 19357 } 19357 if (!psMetadataAdd(md, PS_LIST_TAIL, "node", PS_DATA_S 32, NULL, node)) {19358 if (!psMetadataAdd(md, PS_LIST_TAIL, "node", PS_DATA_STRING, NULL, node)) { 19358 19359 psError(PS_ERR_UNKNOWN, false, "failed to add item node"); 19359 19360 psFree(md); … … 19466 19467 return false; 19467 19468 } 19468 if (!psMetadataAdd(md, PS_LIST_TAIL, "node", PS_DATA_S 32, NULL, object->node)) {19469 if (!psMetadataAdd(md, PS_LIST_TAIL, "node", PS_DATA_STRING, NULL, object->node)) { 19469 19470 psError(PS_ERR_UNKNOWN, false, "failed to add item node"); 19470 19471 psFree(md); … … 19490 19491 return false; 19491 19492 } 19492 psS32 node = psMetadataLookupS32(&status, md, "node");19493 char* node = psMetadataLookupPtr(&status, md, "node"); 19493 19494 if (!status) { 19494 19495 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item node"); -
trunk/ippdb/src/ippdb.h
r14598 r15003 9070 9070 psS64 magic_id; 9071 9071 psS64 diff_id; 9072 psS32node;9072 char *node; 9073 9073 } magicInputSkyfileRow; 9074 9074 … … 9081 9081 psS64 magic_id, 9082 9082 psS64 diff_id, 9083 psS32node9083 const char *node 9084 9084 ); 9085 9085 … … 9113 9113 psS64 magic_id, 9114 9114 psS64 diff_id, 9115 psS32node9115 const char *node 9116 9116 ); 9117 9117 -
trunk/ippdb/tests/alloc.c
r14598 r15003 2195 2195 magicInputSkyfileRow *object; 2196 2196 2197 object = magicInputSkyfileRowAlloc(-64, -64, -32);2197 object = magicInputSkyfileRowAlloc(-64, -64, "a string" ); 2198 2198 2199 2199 if (!object) { … … 2209 2209 exit(EXIT_FAILURE); 2210 2210 } 2211 if ( !object->node == -32) {2211 if (strncmp(object->node, "a string", MAX_STRING_LENGTH)) { 2212 2212 psFree(object); 2213 2213 exit(EXIT_FAILURE); -
trunk/ippdb/tests/insert.c
r14598 r15003 613 613 } 614 614 615 if (!magicInputSkyfileInsert(dbh, -64, -64, -32)) {615 if (!magicInputSkyfileInsert(dbh, -64, -64, "a string")) { 616 616 exit(EXIT_FAILURE); 617 617 } -
trunk/ippdb/tests/insertobject.c
r14598 r15003 894 894 } 895 895 896 object = magicInputSkyfileRowAlloc(-64, -64, -32);896 object = magicInputSkyfileRowAlloc(-64, -64, "a string"); 897 897 if (!object) { 898 898 exit(EXIT_FAILURE); -
trunk/ippdb/tests/metadatafromobject.c
r14598 r15003 2452 2452 bool status; 2453 2453 2454 object = magicInputSkyfileRowAlloc(-64, -64, -32);2454 object = magicInputSkyfileRowAlloc(-64, -64, "a string"); 2455 2455 if (!object) { 2456 2456 exit(EXIT_FAILURE); … … 2470 2470 exit(EXIT_FAILURE); 2471 2471 } 2472 if ( !psMetadataLookupS32(&status, md, "node") == -32) {2472 if (strncmp(psMetadataLookupPtr(&status, md, "node"), "a string", MAX_STRING_LENGTH)) { 2473 2473 psFree(md); 2474 2474 exit(EXIT_FAILURE); -
trunk/ippdb/tests/objectfrommetadata.c
r14598 r15003 3937 3937 exit(EXIT_FAILURE); 3938 3938 } 3939 if (!psMetadataAddS 32(md, PS_LIST_TAIL, "node", 0, NULL, -32)) {3939 if (!psMetadataAddStr(md, PS_LIST_TAIL, "node", 0, NULL, "a string")) { 3940 3940 psFree(md); 3941 3941 exit(EXIT_FAILURE); … … 3956 3956 exit(EXIT_FAILURE); 3957 3957 } 3958 if ( !object->node == -32) {3958 if (strncmp(object->node, "a string", MAX_STRING_LENGTH)) { 3959 3959 psFree(object); 3960 3960 exit(EXIT_FAILURE);
Note:
See TracChangeset
for help on using the changeset viewer.
