Changeset 11005
- Timestamp:
- Jan 9, 2007, 4:00:11 PM (19 years ago)
- Location:
- trunk/ippdb
- Files:
-
- 8 edited
-
configure.ac (modified) (1 diff)
-
src/ippdb.c (modified) (16 diffs)
-
src/ippdb.h (modified) (6 diffs)
-
tests/alloc.c (modified) (4 diffs)
-
tests/insert.c (modified) (1 diff)
-
tests/insertobject.c (modified) (2 diffs)
-
tests/metadatafromobject.c (modified) (4 diffs)
-
tests/objectfrommetadata.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/configure.ac
r10989 r11005 7 7 AC_PREREQ(2.59) 8 8 9 AC_INIT([ippdb], [0.0. 69], [pan-starrs.ifa.hawaii.edu])9 AC_INIT([ippdb], [0.0.70], [pan-starrs.ifa.hawaii.edu]) 10 10 AC_CONFIG_SRCDIR([ippdb.pc.in]) 11 11 -
trunk/ippdb/src/ippdb.c
r10989 r11005 5879 5879 static void p2PendingExpRowFree(p2PendingExpRow *object); 5880 5880 5881 p2PendingExpRow *p2PendingExpRowAlloc(const char *exp_tag, const char *recipe, psS32 p1_version, psS32 p2_version, const char *label )5881 p2PendingExpRow *p2PendingExpRowAlloc(const char *exp_tag, const char *recipe, psS32 p1_version, psS32 p2_version, const char *label, psS16 fault) 5882 5882 { 5883 5883 p2PendingExpRow *_object; … … 5891 5891 _object->p2_version = p2_version; 5892 5892 _object->label = psStringCopy(label); 5893 _object->fault = fault; 5893 5894 5894 5895 return _object; … … 5930 5931 return false; 5931 5932 } 5933 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) { 5934 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 5935 psFree(md); 5936 return false; 5937 } 5932 5938 5933 5939 bool status = psDBCreateTable(dbh, P2PENDINGEXP_TABLE_NAME, md); … … 5943 5949 } 5944 5950 5945 bool p2PendingExpInsert(psDB * dbh, const char *exp_tag, const char *recipe, psS32 p1_version, psS32 p2_version, const char *label )5951 bool p2PendingExpInsert(psDB * dbh, const char *exp_tag, const char *recipe, psS32 p1_version, psS32 p2_version, const char *label, psS16 fault) 5946 5952 { 5947 5953 psMetadata *md = psMetadataAlloc(); … … 5968 5974 if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, NULL, label)) { 5969 5975 psError(PS_ERR_UNKNOWN, false, "failed to add item label"); 5976 psFree(md); 5977 return false; 5978 } 5979 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) { 5980 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 5970 5981 psFree(md); 5971 5982 return false; … … 5994 6005 bool p2PendingExpInsertObject(psDB *dbh, p2PendingExpRow *object) 5995 6006 { 5996 return p2PendingExpInsert(dbh, object->exp_tag, object->recipe, object->p1_version, object->p2_version, object->label );6007 return p2PendingExpInsert(dbh, object->exp_tag, object->recipe, object->p1_version, object->p2_version, object->label, object->fault); 5997 6008 } 5998 6009 … … 6092 6103 return false; 6093 6104 } 6105 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) { 6106 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 6107 psFree(md); 6108 return false; 6109 } 6094 6110 6095 6111 … … 6126 6142 return false; 6127 6143 } 6128 6129 return p2PendingExpRowAlloc(exp_tag, recipe, p1_version, p2_version, label); 6144 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 6145 if (!status) { 6146 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault"); 6147 return false; 6148 } 6149 6150 return p2PendingExpRowAlloc(exp_tag, recipe, p1_version, p2_version, label, fault); 6130 6151 } 6131 6152 psArray *p2PendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 6239 6260 static void p2PendingImfileRowFree(p2PendingImfileRow *object); 6240 6261 6241 p2PendingImfileRow *p2PendingImfileRowAlloc(const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psS32 p1_version, psS32 p2_version )6262 p2PendingImfileRow *p2PendingImfileRowAlloc(const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psS32 p1_version, psS32 p2_version, psS16 fault) 6242 6263 { 6243 6264 p2PendingImfileRow *_object; … … 6252 6273 _object->p1_version = p1_version; 6253 6274 _object->p2_version = p2_version; 6275 _object->fault = fault; 6254 6276 6255 6277 return _object; … … 6297 6319 return false; 6298 6320 } 6321 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) { 6322 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 6323 psFree(md); 6324 return false; 6325 } 6299 6326 6300 6327 bool status = psDBCreateTable(dbh, P2PENDINGIMFILE_TABLE_NAME, md); … … 6310 6337 } 6311 6338 6312 bool p2PendingImfileInsert(psDB * dbh, const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psS32 p1_version, psS32 p2_version )6339 bool p2PendingImfileInsert(psDB * dbh, const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psS32 p1_version, psS32 p2_version, psS16 fault) 6313 6340 { 6314 6341 psMetadata *md = psMetadataAlloc(); … … 6340 6367 if (!psMetadataAdd(md, PS_LIST_TAIL, "p2_version", PS_DATA_S32, NULL, p2_version)) { 6341 6368 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version"); 6369 psFree(md); 6370 return false; 6371 } 6372 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) { 6373 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 6342 6374 psFree(md); 6343 6375 return false; … … 6366 6398 bool p2PendingImfileInsertObject(psDB *dbh, p2PendingImfileRow *object) 6367 6399 { 6368 return p2PendingImfileInsert(dbh, object->exp_tag, object->class_id, object->uri, object->recipe, object->p1_version, object->p2_version );6400 return p2PendingImfileInsert(dbh, object->exp_tag, object->class_id, object->uri, object->recipe, object->p1_version, object->p2_version, object->fault); 6369 6401 } 6370 6402 … … 6469 6501 return false; 6470 6502 } 6503 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) { 6504 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 6505 psFree(md); 6506 return false; 6507 } 6471 6508 6472 6509 … … 6508 6545 return false; 6509 6546 } 6510 6511 return p2PendingImfileRowAlloc(exp_tag, class_id, uri, recipe, p1_version, p2_version); 6547 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 6548 if (!status) { 6549 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault"); 6550 return false; 6551 } 6552 6553 return p2PendingImfileRowAlloc(exp_tag, class_id, uri, recipe, p1_version, p2_version, fault); 6512 6554 } 6513 6555 psArray *p2PendingImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) -
trunk/ippdb/src/ippdb.h
r10989 r11005 2959 2959 psS32 p2_version; 2960 2960 char *label; 2961 psS16 fault; 2961 2962 } p2PendingExpRow; 2962 2963 … … 2971 2972 psS32 p1_version, 2972 2973 psS32 p2_version, 2973 const char *label 2974 const char *label, 2975 psS16 fault 2974 2976 ); 2975 2977 … … 3005 3007 psS32 p1_version, 3006 3008 psS32 p2_version, 3007 const char *label 3009 const char *label, 3010 psS16 fault 3008 3011 ); 3009 3012 … … 3167 3170 psS32 p1_version; 3168 3171 psS32 p2_version; 3172 psS16 fault; 3169 3173 } p2PendingImfileRow; 3170 3174 … … 3180 3184 const char *recipe, 3181 3185 psS32 p1_version, 3182 psS32 p2_version 3186 psS32 p2_version, 3187 psS16 fault 3183 3188 ); 3184 3189 … … 3215 3220 const char *recipe, 3216 3221 psS32 p1_version, 3217 psS32 p2_version 3222 psS32 p2_version, 3223 psS16 fault 3218 3224 ); 3219 3225 -
trunk/ippdb/tests/alloc.c
r10989 r11005 608 608 p2PendingExpRow *object; 609 609 610 object = p2PendingExpRowAlloc("a string", "a string", -32, -32, "a string" );610 object = p2PendingExpRowAlloc("a string", "a string", -32, -32, "a string", -16 ); 611 611 612 612 if (!object) { … … 634 634 exit(EXIT_FAILURE); 635 635 } 636 psFree(object); 637 exit(EXIT_FAILURE); 638 } 636 639 637 640 psFree(object); … … 641 644 p2PendingImfileRow *object; 642 645 643 object = p2PendingImfileRowAlloc("a string", "a string", "a string", "a string", -32, -32 );646 object = p2PendingImfileRowAlloc("a string", "a string", "a string", "a string", -32, -32, -16 ); 644 647 645 648 if (!object) { … … 668 671 } 669 672 if (!object->p2_version == -32) { 673 psFree(object); 674 exit(EXIT_FAILURE); 675 } 670 676 psFree(object); 671 677 exit(EXIT_FAILURE); -
trunk/ippdb/tests/insert.c
r10989 r11005 208 208 } 209 209 210 if (!p2PendingExpInsert(dbh, "a string", "a string", -32, -32, "a string" )) {211 exit(EXIT_FAILURE); 212 } 213 214 psDBCleanup(dbh); 215 } 216 217 { 218 psDB *dbh; 219 220 dbh = psDBInit("localhost", "test", NULL, "test"); 221 if (!dbh) { 222 exit(EXIT_FAILURE); 223 } 224 225 if (!p2PendingImfileInsert(dbh, "a string", "a string", "a string", "a string", -32, -32 )) {210 if (!p2PendingExpInsert(dbh, "a string", "a string", -32, -32, "a string", -16)) { 211 exit(EXIT_FAILURE); 212 } 213 214 psDBCleanup(dbh); 215 } 216 217 { 218 psDB *dbh; 219 220 dbh = psDBInit("localhost", "test", NULL, "test"); 221 if (!dbh) { 222 exit(EXIT_FAILURE); 223 } 224 225 if (!p2PendingImfileInsert(dbh, "a string", "a string", "a string", "a string", -32, -32, -16)) { 226 226 exit(EXIT_FAILURE); 227 227 } -
trunk/ippdb/tests/insertobject.c
r10989 r11005 300 300 } 301 301 302 object = p2PendingExpRowAlloc("a string", "a string", -32, -32, "a string" );302 object = p2PendingExpRowAlloc("a string", "a string", -32, -32, "a string", -16); 303 303 if (!object) { 304 304 exit(EXIT_FAILURE); … … 322 322 } 323 323 324 object = p2PendingImfileRowAlloc("a string", "a string", "a string", "a string", -32, -32 );324 object = p2PendingImfileRowAlloc("a string", "a string", "a string", "a string", -32, -32, -16); 325 325 if (!object) { 326 326 exit(EXIT_FAILURE); -
trunk/ippdb/tests/metadatafromobject.c
r10989 r11005 714 714 bool status; 715 715 716 object = p2PendingExpRowAlloc("a string", "a string", -32, -32, "a string" );716 object = p2PendingExpRowAlloc("a string", "a string", -32, -32, "a string", -16); 717 717 if (!object) { 718 718 exit(EXIT_FAILURE); … … 746 746 exit(EXIT_FAILURE); 747 747 } 748 psFree(md); 749 exit(EXIT_FAILURE); 750 } 748 751 749 752 psFree(md); … … 755 758 bool status; 756 759 757 object = p2PendingImfileRowAlloc("a string", "a string", "a string", "a string", -32, -32 );760 object = p2PendingImfileRowAlloc("a string", "a string", "a string", "a string", -32, -32, -16); 758 761 if (!object) { 759 762 exit(EXIT_FAILURE); … … 788 791 } 789 792 if (!psMetadataLookupS32(&status, md, "p2_version") == -32) { 793 psFree(md); 794 exit(EXIT_FAILURE); 795 } 790 796 psFree(md); 791 797 exit(EXIT_FAILURE); -
trunk/ippdb/tests/objectfrommetadata.c
r10989 r11005 1123 1123 exit(EXIT_FAILURE); 1124 1124 } 1125 psFree(md); 1126 exit(EXIT_FAILURE); 1127 } 1125 1128 1126 1129 object = p2PendingExpObjectFromMetadata(md); … … 1152 1155 exit(EXIT_FAILURE); 1153 1156 } 1157 psFree(object); 1158 exit(EXIT_FAILURE); 1159 } 1154 1160 1155 1161 psFree(object); … … 1185 1191 exit(EXIT_FAILURE); 1186 1192 } 1193 psFree(md); 1194 exit(EXIT_FAILURE); 1195 } 1187 1196 1188 1197 object = p2PendingImfileObjectFromMetadata(md); … … 1215 1224 } 1216 1225 if (!object->p2_version == -32) { 1226 psFree(object); 1227 exit(EXIT_FAILURE); 1228 } 1217 1229 psFree(object); 1218 1230 exit(EXIT_FAILURE);
Note:
See TracChangeset
for help on using the changeset viewer.
