Changeset 17570 for trunk/ippdb/src
- Timestamp:
- May 7, 2008, 3:47:34 PM (18 years ago)
- Location:
- trunk/ippdb/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/src/ippdb.c
r17144 r17570 586 586 static void summitExpRowFree(summitExpRow *object); 587 587 588 summitExpRow *summitExpRowAlloc(const char *exp_name, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, const char *uri, psS32 imfiles )588 summitExpRow *summitExpRowAlloc(const char *exp_name, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, const char *uri, psS32 imfiles, psS16 fault) 589 589 { 590 590 summitExpRow *_object; … … 600 600 _object->uri = psStringCopy(uri); 601 601 _object->imfiles = imfiles; 602 _object->fault = fault; 602 603 603 604 return _object; … … 652 653 return false; 653 654 } 655 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "Key NOT NULL", 0)) { 656 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 657 psFree(md); 658 return false; 659 } 654 660 655 661 bool status = psDBCreateTable(dbh, SUMMITEXP_TABLE_NAME, md); … … 665 671 } 666 672 667 bool summitExpInsert(psDB * dbh, const char *exp_name, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, const char *uri, psS32 imfiles )673 bool summitExpInsert(psDB * dbh, const char *exp_name, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, const char *uri, psS32 imfiles, psS16 fault) 668 674 { 669 675 psMetadata *md = psMetadataAlloc(); … … 700 706 if (!psMetadataAdd(md, PS_LIST_TAIL, "imfiles", PS_DATA_S32, NULL, imfiles)) { 701 707 psError(PS_ERR_UNKNOWN, false, "failed to add item imfiles"); 708 psFree(md); 709 return false; 710 } 711 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) { 712 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 702 713 psFree(md); 703 714 return false; … … 726 737 bool summitExpInsertObject(psDB *dbh, summitExpRow *object) 727 738 { 728 return summitExpInsert(dbh, object->exp_name, object->camera, object->telescope, object->dateobs, object->exp_type, object->uri, object->imfiles );739 return summitExpInsert(dbh, object->exp_name, object->camera, object->telescope, object->dateobs, object->exp_type, object->uri, object->imfiles, object->fault); 729 740 } 730 741 … … 834 845 return false; 835 846 } 847 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) { 848 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 849 psFree(md); 850 return false; 851 } 836 852 837 853 … … 878 894 return false; 879 895 } 880 881 return summitExpRowAlloc(exp_name, camera, telescope, dateobs, exp_type, uri, imfiles); 896 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 897 if (!status) { 898 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault"); 899 return false; 900 } 901 902 return summitExpRowAlloc(exp_name, camera, telescope, dateobs, exp_type, uri, imfiles, fault); 882 903 } 883 904 psArray *summitExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) -
trunk/ippdb/src/ippdb.h
r17144 r17570 339 339 char *uri; 340 340 psS32 imfiles; 341 psS16 fault; 341 342 } summitExpRow; 342 343 … … 353 354 const char *exp_type, 354 355 const char *uri, 355 psS32 imfiles 356 psS32 imfiles, 357 psS16 fault 356 358 ); 357 359 … … 389 391 const char *exp_type, 390 392 const char *uri, 391 psS32 imfiles 393 psS32 imfiles, 394 psS16 fault 392 395 ); 393 396
Note:
See TracChangeset
for help on using the changeset viewer.
