Changeset 8020 for branches/jhoblitt/ippdb/src/ippdb.c
- Timestamp:
- Jul 31, 2006, 3:44:47 PM (20 years ago)
- File:
-
- 1 edited
-
branches/jhoblitt/ippdb/src/ippdb.c (modified) (28 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/jhoblitt/ippdb/src/ippdb.c
r8006 r8020 4670 4670 static void pzPendingImfileRowFree(pzPendingImfileRow *object); 4671 4671 4672 pzPendingImfileRow *pzPendingImfileRowAlloc(const char *exp_id, psS32 bytes, const char *md5sum, const char *class , const char *class_id, const char *uri)4672 pzPendingImfileRow *pzPendingImfileRowAlloc(const char *exp_id, psS32 bytes, const char *md5sum, const char *class_id, const char *uri) 4673 4673 { 4674 4674 pzPendingImfileRow *object; … … 4680 4680 object->bytes = bytes; 4681 4681 object->md5sum = psStringCopy(md5sum); 4682 object->class = psStringCopy(class);4683 4682 object->class_id = psStringCopy(class_id); 4684 4683 object->uri = psStringCopy(uri); … … 4691 4690 psFree(object->exp_id); 4692 4691 psFree(object->md5sum); 4693 psFree(object->class);4694 4692 psFree(object->class_id); 4695 4693 psFree(object->uri); … … 4722 4720 return false; 4723 4721 } 4724 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "64")) {4725 psError(PS_ERR_UNKNOWN, false, "failed to add item class");4726 psFree(md);4727 return false;4728 }4729 4722 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class_id", 0, NULL, "64")) { 4730 4723 psError(PS_ERR_UNKNOWN, false, "failed to add item class_id"); … … 4750 4743 } 4751 4744 4752 bool pzPendingImfileInsert(psDB * dbh, const char *exp_id, psS32 bytes, const char *md5sum, const char *class , const char *class_id, const char *uri)4745 bool pzPendingImfileInsert(psDB * dbh, const char *exp_id, psS32 bytes, const char *md5sum, const char *class_id, const char *uri) 4753 4746 { 4754 4747 psMetadata *md; … … 4771 4764 return false; 4772 4765 } 4773 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) {4774 psError(PS_ERR_UNKNOWN, false, "failed to add item class");4775 psFree(md);4776 return false;4777 }4778 4766 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class_id", 0, NULL, class_id)) { 4779 4767 psError(PS_ERR_UNKNOWN, false, "failed to add item class_id"); … … 4793 4781 } 4794 4782 4795 bool pzPendingImfilePop(psDB *dbh, char **exp_id, psS32 *bytes, char **md5sum, char **class , char **class_id, char **uri)4783 bool pzPendingImfilePop(psDB *dbh, char **exp_id, psS32 *bytes, char **md5sum, char **class_id, char **uri) 4796 4784 { 4797 4785 psArray *rowSet; … … 4855 4843 return false; 4856 4844 } 4857 *class = psMetadataLookupPtr(&status, row, "class");4858 if (!status) {4859 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");4860 psFree(row);4861 return false;4862 }4863 4845 *class_id = psMetadataLookupPtr(&status, row, "class_id"); 4864 4846 if (!status) { … … 4881 4863 bool pzPendingImfileInsertObject(psDB *dbh, pzPendingImfileRow *object) 4882 4864 { 4883 return pzPendingImfileInsert(dbh, object->exp_id, object->bytes, object->md5sum, object->class , object->class_id, object->uri);4865 return pzPendingImfileInsert(dbh, object->exp_id, object->bytes, object->md5sum, object->class_id, object->uri); 4884 4866 } 4885 4867 … … 4889 4871 psS32 bytes; 4890 4872 char md5sum[256]; 4891 char class[256];4892 4873 char class_id[256]; 4893 4874 char uri[256]; 4894 4875 4895 if (!pzPendingImfilePop(dbh, (char **)&exp_id, &bytes, (char **)&md5sum, (char **)&class , (char **)&class_id, (char **)&uri)) {4876 if (!pzPendingImfilePop(dbh, (char **)&exp_id, &bytes, (char **)&md5sum, (char **)&class_id, (char **)&uri)) { 4896 4877 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 4897 4878 return NULL; 4898 4879 } 4899 4880 4900 return pzPendingImfileRowAlloc(exp_id, bytes, md5sum, class , class_id, uri);4881 return pzPendingImfileRowAlloc(exp_id, bytes, md5sum, class_id, uri); 4901 4882 } 4902 4883 … … 5012 4993 return NULL; 5013 4994 } 5014 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) {5015 psError(PS_ERR_UNKNOWN, false, "failed to add item class");5016 psFree(md);5017 return NULL;5018 }5019 4995 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class_id", 0, NULL, object->class_id)) { 5020 4996 psError(PS_ERR_UNKNOWN, false, "failed to add item class_id"); … … 5037 5013 psS32 bytes; 5038 5014 char *md5sum; 5039 char *class;5040 5015 char *class_id; 5041 5016 char *uri; … … 5056 5031 return false; 5057 5032 } 5058 class = psMetadataLookupPtr(&status, md, "class");5059 if (!status) {5060 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");5061 return false;5062 }5063 5033 class_id = psMetadataLookupPtr(&status, md, "class_id"); 5064 5034 if (!status) { … … 5072 5042 } 5073 5043 5074 return pzPendingImfileRowAlloc(exp_id, bytes, md5sum, class , class_id, uri);5044 return pzPendingImfileRowAlloc(exp_id, bytes, md5sum, class_id, uri); 5075 5045 } 5076 5046 psArray *pzPendingImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 5560 5530 static void newImfileRowFree(newImfileRow *object); 5561 5531 5562 newImfileRow *newImfileRowAlloc(const char *exp_id, const char *class , const char *class_id, const char *uri)5532 newImfileRow *newImfileRowAlloc(const char *exp_id, const char *class_id, const char *uri) 5563 5533 { 5564 5534 newImfileRow *object; … … 5568 5538 5569 5539 object->exp_id = psStringCopy(exp_id); 5570 object->class = psStringCopy(class);5571 5540 object->class_id = psStringCopy(class_id); 5572 5541 object->uri = psStringCopy(uri); … … 5578 5547 { 5579 5548 psFree(object->exp_id); 5580 psFree(object->class);5581 5549 psFree(object->class_id); 5582 5550 psFree(object->uri); … … 5599 5567 return false; 5600 5568 } 5601 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, "64")) {5602 psError(PS_ERR_UNKNOWN, false, "failed to add item class");5603 psFree(md);5604 return false;5605 }5606 5569 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class_id", 0, NULL, "64")) { 5607 5570 psError(PS_ERR_UNKNOWN, false, "failed to add item class_id"); … … 5627 5590 } 5628 5591 5629 bool newImfileInsert(psDB * dbh, const char *exp_id, const char *class , const char *class_id, const char *uri)5592 bool newImfileInsert(psDB * dbh, const char *exp_id, const char *class_id, const char *uri) 5630 5593 { 5631 5594 psMetadata *md; … … 5638 5601 return false; 5639 5602 } 5640 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, class)) {5641 psError(PS_ERR_UNKNOWN, false, "failed to add item class");5642 psFree(md);5643 return false;5644 }5645 5603 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class_id", 0, NULL, class_id)) { 5646 5604 psError(PS_ERR_UNKNOWN, false, "failed to add item class_id"); … … 5660 5618 } 5661 5619 5662 bool newImfilePop(psDB *dbh, char **exp_id, char **class , char **class_id, char **uri)5620 bool newImfilePop(psDB *dbh, char **exp_id, char **class_id, char **uri) 5663 5621 { 5664 5622 psArray *rowSet; … … 5710 5668 return false; 5711 5669 } 5712 *class = psMetadataLookupPtr(&status, row, "class");5713 if (!status) {5714 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");5715 psFree(row);5716 return false;5717 }5718 5670 *class_id = psMetadataLookupPtr(&status, row, "class_id"); 5719 5671 if (!status) { … … 5736 5688 bool newImfileInsertObject(psDB *dbh, newImfileRow *object) 5737 5689 { 5738 return newImfileInsert(dbh, object->exp_id, object->class , object->class_id, object->uri);5690 return newImfileInsert(dbh, object->exp_id, object->class_id, object->uri); 5739 5691 } 5740 5692 … … 5742 5694 { 5743 5695 char exp_id[256]; 5744 char class[256];5745 5696 char class_id[256]; 5746 5697 char uri[256]; 5747 5698 5748 if (!newImfilePop(dbh, (char **)&exp_id, (char **)&class , (char **)&class_id, (char **)&uri)) {5699 if (!newImfilePop(dbh, (char **)&exp_id, (char **)&class_id, (char **)&uri)) { 5749 5700 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 5750 5701 return NULL; 5751 5702 } 5752 5703 5753 return newImfileRowAlloc(exp_id, class , class_id, uri);5704 return newImfileRowAlloc(exp_id, class_id, uri); 5754 5705 } 5755 5706 … … 5855 5806 return NULL; 5856 5807 } 5857 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class", 0, NULL, object->class)) {5858 psError(PS_ERR_UNKNOWN, false, "failed to add item class");5859 psFree(md);5860 return NULL;5861 }5862 5808 if (!psMetadataAddStr(md, PS_LIST_TAIL, "class_id", 0, NULL, object->class_id)) { 5863 5809 psError(PS_ERR_UNKNOWN, false, "failed to add item class_id"); … … 5878 5824 bool status; 5879 5825 char *exp_id; 5880 char *class;5881 5826 char *class_id; 5882 5827 char *uri; … … 5887 5832 return false; 5888 5833 } 5889 class = psMetadataLookupPtr(&status, md, "class");5890 if (!status) {5891 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item class");5892 return false;5893 }5894 5834 class_id = psMetadataLookupPtr(&status, md, "class_id"); 5895 5835 if (!status) { … … 5903 5843 } 5904 5844 5905 return newImfileRowAlloc(exp_id, class , class_id, uri);5845 return newImfileRowAlloc(exp_id, class_id, uri); 5906 5846 } 5907 5847 psArray *newImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Note:
See TracChangeset
for help on using the changeset viewer.
