Changeset 11030
- Timestamp:
- Jan 11, 2007, 11:59:35 AM (19 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
-
dbconfig/config.md (modified) (1 diff)
-
dbconfig/tasks.md (modified) (4 diffs)
-
ippdb/configure.ac (modified) (1 diff)
-
ippdb/src/ippdb.c (modified) (24 diffs)
-
ippdb/src/ippdb.h (modified) (9 diffs)
-
ippdb/tests/alloc.c (modified) (6 diffs)
-
ippdb/tests/insert.c (modified) (2 diffs)
-
ippdb/tests/insertobject.c (modified) (3 diffs)
-
ippdb/tests/metadatafromobject.c (modified) (6 diffs)
-
ippdb/tests/objectfrommetadata.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dbconfig/config.md
r11026 r11030 2 2 pkg_name STR ippdb 3 3 pkg_namespace STR ippdb 4 pkg_version STR 0.0.7 14 pkg_version STR 0.0.72 5 5 END -
trunk/dbconfig/tasks.md
r11026 r11030 1 # $Id: tasks.md,v 1.10 3 2007-01-11 04:43:37jhoblitt Exp $1 # $Id: tasks.md,v 1.104 2007-01-11 21:59:35 jhoblitt Exp $ 2 2 3 3 # this table records all exposure ID ever seen from the summit … … 192 192 p2_version S32 0 193 193 label STR 64 # key 194 fault S16 0 # NOT NULL195 194 END 196 195 … … 204 203 p1_version S32 0 205 204 p2_version S32 0 206 fault S16 0 # NOT NULL207 205 END 208 206 … … 236 234 p1_version S32 0 237 235 p2_version S32 0 236 fault S16 0 # NOT NULL 238 237 END 239 238 -
trunk/ippdb/configure.ac
r11027 r11030 7 7 AC_PREREQ(2.59) 8 8 9 AC_INIT([ippdb], [0.0.7 1], [pan-starrs.ifa.hawaii.edu])9 AC_INIT([ippdb], [0.0.72], [pan-starrs.ifa.hawaii.edu]) 10 10 AC_CONFIG_SRCDIR([ippdb.pc.in]) 11 11 -
trunk/ippdb/src/ippdb.c
r11027 r11030 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 , psS16 fault)5881 p2PendingExpRow *p2PendingExpRowAlloc(const char *exp_tag, const char *recipe, psS32 p1_version, psS32 p2_version, const char *label) 5882 5882 { 5883 5883 p2PendingExpRow *_object; … … 5891 5891 _object->p2_version = p2_version; 5892 5892 _object->label = psStringCopy(label); 5893 _object->fault = fault;5894 5893 5895 5894 return _object; … … 5931 5930 return false; 5932 5931 } 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 }5938 5932 5939 5933 bool status = psDBCreateTable(dbh, P2PENDINGEXP_TABLE_NAME, md); … … 5949 5943 } 5950 5944 5951 bool p2PendingExpInsert(psDB * dbh, const char *exp_tag, const char *recipe, psS32 p1_version, psS32 p2_version, const char *label , psS16 fault)5945 bool p2PendingExpInsert(psDB * dbh, const char *exp_tag, const char *recipe, psS32 p1_version, psS32 p2_version, const char *label) 5952 5946 { 5953 5947 psMetadata *md = psMetadataAlloc(); … … 5974 5968 if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, NULL, label)) { 5975 5969 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");5981 5970 psFree(md); 5982 5971 return false; … … 6005 5994 bool p2PendingExpInsertObject(psDB *dbh, p2PendingExpRow *object) 6006 5995 { 6007 return p2PendingExpInsert(dbh, object->exp_tag, object->recipe, object->p1_version, object->p2_version, object->label , object->fault);5996 return p2PendingExpInsert(dbh, object->exp_tag, object->recipe, object->p1_version, object->p2_version, object->label); 6008 5997 } 6009 5998 … … 6103 6092 return false; 6104 6093 } 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 }6110 6094 6111 6095 … … 6142 6126 return false; 6143 6127 } 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); 6128 6129 return p2PendingExpRowAlloc(exp_tag, recipe, p1_version, p2_version, label); 6151 6130 } 6152 6131 psArray *p2PendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 6260 6239 static void p2PendingImfileRowFree(p2PendingImfileRow *object); 6261 6240 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)6241 p2PendingImfileRow *p2PendingImfileRowAlloc(const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psS32 p1_version, psS32 p2_version) 6263 6242 { 6264 6243 p2PendingImfileRow *_object; … … 6273 6252 _object->p1_version = p1_version; 6274 6253 _object->p2_version = p2_version; 6275 _object->fault = fault;6276 6254 6277 6255 return _object; … … 6319 6297 return false; 6320 6298 } 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 }6326 6299 6327 6300 bool status = psDBCreateTable(dbh, P2PENDINGIMFILE_TABLE_NAME, md); … … 6337 6310 } 6338 6311 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)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) 6340 6313 { 6341 6314 psMetadata *md = psMetadataAlloc(); … … 6367 6340 if (!psMetadataAdd(md, PS_LIST_TAIL, "p2_version", PS_DATA_S32, NULL, p2_version)) { 6368 6341 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");6374 6342 psFree(md); 6375 6343 return false; … … 6398 6366 bool p2PendingImfileInsertObject(psDB *dbh, p2PendingImfileRow *object) 6399 6367 { 6400 return p2PendingImfileInsert(dbh, object->exp_tag, object->class_id, object->uri, object->recipe, object->p1_version, object->p2_version , object->fault);6368 return p2PendingImfileInsert(dbh, object->exp_tag, object->class_id, object->uri, object->recipe, object->p1_version, object->p2_version); 6401 6369 } 6402 6370 … … 6501 6469 return false; 6502 6470 } 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 }6508 6471 6509 6472 … … 6545 6508 return false; 6546 6509 } 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); 6510 6511 return p2PendingImfileRowAlloc(exp_tag, class_id, uri, recipe, p1_version, p2_version); 6554 6512 } 6555 6513 psArray *p2PendingImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 7275 7233 static void p2ProcessedImfileRowFree(p2ProcessedImfileRow *object); 7276 7234 7277 p2ProcessedImfileRow *p2ProcessedImfileRowAlloc(const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS32 p1_version, psS32 p2_version )7235 p2ProcessedImfileRow *p2ProcessedImfileRowAlloc(const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS32 p1_version, psS32 p2_version, psS16 fault) 7278 7236 { 7279 7237 p2ProcessedImfileRow *_object; … … 7293 7251 _object->p1_version = p1_version; 7294 7252 _object->p2_version = p2_version; 7253 _object->fault = fault; 7295 7254 7296 7255 return _object; … … 7365 7324 return false; 7366 7325 } 7326 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) { 7327 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 7328 psFree(md); 7329 return false; 7330 } 7367 7331 7368 7332 bool status = psDBCreateTable(dbh, P2PROCESSEDIMFILE_TABLE_NAME, md); … … 7378 7342 } 7379 7343 7380 bool p2ProcessedImfileInsert(psDB * dbh, const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS32 p1_version, psS32 p2_version )7344 bool p2ProcessedImfileInsert(psDB * dbh, const char *exp_tag, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS32 p1_version, psS32 p2_version, psS16 fault) 7381 7345 { 7382 7346 psMetadata *md = psMetadataAlloc(); … … 7433 7397 if (!psMetadataAdd(md, PS_LIST_TAIL, "p2_version", PS_DATA_S32, NULL, p2_version)) { 7434 7398 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version"); 7399 psFree(md); 7400 return false; 7401 } 7402 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) { 7403 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 7435 7404 psFree(md); 7436 7405 return false; … … 7459 7428 bool p2ProcessedImfileInsertObject(psDB *dbh, p2ProcessedImfileRow *object) 7460 7429 { 7461 return p2ProcessedImfileInsert(dbh, object->exp_tag, object->class_id, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri, object->p1_version, object->p2_version );7430 return p2ProcessedImfileInsert(dbh, object->exp_tag, object->class_id, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri, object->p1_version, object->p2_version, object->fault); 7462 7431 } 7463 7432 … … 7587 7556 return false; 7588 7557 } 7558 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) { 7559 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 7560 psFree(md); 7561 return false; 7562 } 7589 7563 7590 7564 … … 7651 7625 return false; 7652 7626 } 7653 7654 return p2ProcessedImfileRowAlloc(exp_tag, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri, p1_version, p2_version); 7627 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 7628 if (!status) { 7629 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault"); 7630 return false; 7631 } 7632 7633 return p2ProcessedImfileRowAlloc(exp_tag, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri, p1_version, p2_version, fault); 7655 7634 } 7656 7635 psArray *p2ProcessedImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) -
trunk/ippdb/src/ippdb.h
r11027 r11030 2959 2959 psS32 p2_version; 2960 2960 char *label; 2961 psS16 fault;2962 2961 } p2PendingExpRow; 2963 2962 … … 2972 2971 psS32 p1_version, 2973 2972 psS32 p2_version, 2974 const char *label, 2975 psS16 fault 2973 const char *label 2976 2974 ); 2977 2975 … … 3007 3005 psS32 p1_version, 3008 3006 psS32 p2_version, 3009 const char *label, 3010 psS16 fault 3007 const char *label 3011 3008 ); 3012 3009 … … 3170 3167 psS32 p1_version; 3171 3168 psS32 p2_version; 3172 psS16 fault;3173 3169 } p2PendingImfileRow; 3174 3170 … … 3184 3180 const char *recipe, 3185 3181 psS32 p1_version, 3186 psS32 p2_version, 3187 psS16 fault 3182 psS32 p2_version 3188 3183 ); 3189 3184 … … 3220 3215 const char *recipe, 3221 3216 psS32 p1_version, 3222 psS32 p2_version, 3223 psS16 fault 3217 psS32 p2_version 3224 3218 ); 3225 3219 … … 3787 3781 psS32 p1_version; 3788 3782 psS32 p2_version; 3783 psS16 fault; 3789 3784 } p2ProcessedImfileRow; 3790 3785 … … 3805 3800 const char *b2_uri, 3806 3801 psS32 p1_version, 3807 psS32 p2_version 3802 psS32 p2_version, 3803 psS16 fault 3808 3804 ); 3809 3805 … … 3845 3841 const char *b2_uri, 3846 3842 psS32 p1_version, 3847 psS32 p2_version 3843 psS32 p2_version, 3844 psS16 fault 3848 3845 ); 3849 3846 -
trunk/ippdb/tests/alloc.c
r11027 r11030 608 608 p2PendingExpRow *object; 609 609 610 object = p2PendingExpRowAlloc("a string", "a string", -32, -32, "a string" , -16);610 object = p2PendingExpRowAlloc("a string", "a string", -32, -32, "a string" ); 611 611 612 612 if (!object) { … … 634 634 exit(EXIT_FAILURE); 635 635 } 636 psFree(object);637 exit(EXIT_FAILURE);638 }639 636 640 637 psFree(object); … … 644 641 p2PendingImfileRow *object; 645 642 646 object = p2PendingImfileRowAlloc("a string", "a string", "a string", "a string", -32, -32 , -16);643 object = p2PendingImfileRowAlloc("a string", "a string", "a string", "a string", -32, -32 ); 647 644 648 645 if (!object) { … … 674 671 exit(EXIT_FAILURE); 675 672 } 676 psFree(object);677 exit(EXIT_FAILURE);678 }679 673 680 674 psFree(object); … … 730 724 p2ProcessedImfileRow *object; 731 725 732 object = p2ProcessedImfileRowAlloc("a string", "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -32, -32 );726 object = p2ProcessedImfileRowAlloc("a string", "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -32, -32, -16 ); 733 727 734 728 if (!object) { … … 777 771 } 778 772 if (!object->p2_version == -32) { 773 psFree(object); 774 exit(EXIT_FAILURE); 775 } 779 776 psFree(object); 780 777 exit(EXIT_FAILURE); -
trunk/ippdb/tests/insert.c
r11027 r11030 208 208 } 209 209 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)) {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)) { 226 226 exit(EXIT_FAILURE); 227 227 } … … 268 268 } 269 269 270 if (!p2ProcessedImfileInsert(dbh, "a string", "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -32, -32 )) {270 if (!p2ProcessedImfileInsert(dbh, "a string", "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -32, -32, -16)) { 271 271 exit(EXIT_FAILURE); 272 272 } -
trunk/ippdb/tests/insertobject.c
r11027 r11030 300 300 } 301 301 302 object = p2PendingExpRowAlloc("a string", "a string", -32, -32, "a string" , -16);302 object = p2PendingExpRowAlloc("a string", "a string", -32, -32, "a string"); 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 , -16);324 object = p2PendingImfileRowAlloc("a string", "a string", "a string", "a string", -32, -32); 325 325 if (!object) { 326 326 exit(EXIT_FAILURE); … … 388 388 } 389 389 390 object = p2ProcessedImfileRowAlloc("a string", "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -32, -32 );390 object = p2ProcessedImfileRowAlloc("a string", "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -32, -32, -16); 391 391 if (!object) { 392 392 exit(EXIT_FAILURE); -
trunk/ippdb/tests/metadatafromobject.c
r11027 r11030 714 714 bool status; 715 715 716 object = p2PendingExpRowAlloc("a string", "a string", -32, -32, "a string" , -16);716 object = p2PendingExpRowAlloc("a string", "a string", -32, -32, "a string"); 717 717 if (!object) { 718 718 exit(EXIT_FAILURE); … … 746 746 exit(EXIT_FAILURE); 747 747 } 748 psFree(md);749 exit(EXIT_FAILURE);750 }751 748 752 749 psFree(md); … … 758 755 bool status; 759 756 760 object = p2PendingImfileRowAlloc("a string", "a string", "a string", "a string", -32, -32 , -16);757 object = p2PendingImfileRowAlloc("a string", "a string", "a string", "a string", -32, -32); 761 758 if (!object) { 762 759 exit(EXIT_FAILURE); … … 794 791 exit(EXIT_FAILURE); 795 792 } 796 psFree(md);797 exit(EXIT_FAILURE);798 }799 793 800 794 psFree(md); … … 868 862 bool status; 869 863 870 object = p2ProcessedImfileRowAlloc("a string", "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -32, -32 );864 object = p2ProcessedImfileRowAlloc("a string", "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -32, -32, -16); 871 865 if (!object) { 872 866 exit(EXIT_FAILURE); … … 921 915 } 922 916 if (!psMetadataLookupS32(&status, md, "p2_version") == -32) { 917 psFree(md); 918 exit(EXIT_FAILURE); 919 } 923 920 psFree(md); 924 921 exit(EXIT_FAILURE); -
trunk/ippdb/tests/objectfrommetadata.c
r11027 r11030 1123 1123 exit(EXIT_FAILURE); 1124 1124 } 1125 psFree(md);1126 exit(EXIT_FAILURE);1127 }1128 1125 1129 1126 object = p2PendingExpObjectFromMetadata(md); … … 1155 1152 exit(EXIT_FAILURE); 1156 1153 } 1157 psFree(object);1158 exit(EXIT_FAILURE);1159 }1160 1154 1161 1155 psFree(object); … … 1191 1185 exit(EXIT_FAILURE); 1192 1186 } 1193 psFree(md);1194 exit(EXIT_FAILURE);1195 }1196 1187 1197 1188 object = p2PendingImfileObjectFromMetadata(md); … … 1227 1218 exit(EXIT_FAILURE); 1228 1219 } 1229 psFree(object);1230 exit(EXIT_FAILURE);1231 }1232 1220 1233 1221 psFree(object); … … 1359 1347 exit(EXIT_FAILURE); 1360 1348 } 1349 psFree(md); 1350 exit(EXIT_FAILURE); 1351 } 1361 1352 1362 1353 object = p2ProcessedImfileObjectFromMetadata(md); … … 1409 1400 } 1410 1401 if (!object->p2_version == -32) { 1402 psFree(object); 1403 exit(EXIT_FAILURE); 1404 } 1411 1405 psFree(object); 1412 1406 exit(EXIT_FAILURE);
Note:
See TracChangeset
for help on using the changeset viewer.
