Changeset 16616 for trunk/ippdb/src/ippdb.c
- Timestamp:
- Feb 22, 2008, 11:49:29 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippdb/src/ippdb.c (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/src/ippdb.c
r16587 r16616 24789 24789 static void pstampDataStoreRowFree(pstampDataStoreRow *object); 24790 24790 24791 pstampDataStoreRow *pstampDataStoreRowAlloc(psS64 ds_id, const char * uri, const char *lastFileset, const char *state)24791 pstampDataStoreRow *pstampDataStoreRowAlloc(psS64 ds_id, const char *state, const char *lastFileset, const char *outProduct, const char *uri) 24792 24792 { 24793 24793 pstampDataStoreRow *_object; … … 24797 24797 24798 24798 _object->ds_id = ds_id; 24799 _object->state = psStringCopy(state); 24800 _object->lastFileset = psStringCopy(lastFileset); 24801 _object->outProduct = psStringCopy(outProduct); 24799 24802 _object->uri = psStringCopy(uri); 24800 _object->lastFileset = psStringCopy(lastFileset);24801 _object->state = psStringCopy(state);24802 24803 24803 24804 return _object; … … 24806 24807 static void pstampDataStoreRowFree(pstampDataStoreRow *object) 24807 24808 { 24809 psFree(object->state); 24810 psFree(object->lastFileset); 24811 psFree(object->outProduct); 24808 24812 psFree(object->uri); 24809 psFree(object->lastFileset);24810 psFree(object->state);24811 24813 } 24812 24814 … … 24819 24821 return false; 24820 24822 } 24823 if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, "64")) { 24824 psError(PS_ERR_UNKNOWN, false, "failed to add item state"); 24825 psFree(md); 24826 return false; 24827 } 24828 if (!psMetadataAdd(md, PS_LIST_TAIL, "lastFileset", PS_DATA_STRING, NULL, "64")) { 24829 psError(PS_ERR_UNKNOWN, false, "failed to add item lastFileset"); 24830 psFree(md); 24831 return false; 24832 } 24833 if (!psMetadataAdd(md, PS_LIST_TAIL, "outProduct", PS_DATA_STRING, "UNIQUE", "64")) { 24834 psError(PS_ERR_UNKNOWN, false, "failed to add item outProduct"); 24835 psFree(md); 24836 return false; 24837 } 24821 24838 if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, "255")) { 24822 24839 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); … … 24824 24841 return false; 24825 24842 } 24826 if (!psMetadataAdd(md, PS_LIST_TAIL, "lastFileset", PS_DATA_STRING, NULL, "64")) {24827 psError(PS_ERR_UNKNOWN, false, "failed to add item lastFileset");24828 psFree(md);24829 return false;24830 }24831 if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, "64")) {24832 psError(PS_ERR_UNKNOWN, false, "failed to add item state");24833 psFree(md);24834 return false;24835 }24836 24843 24837 24844 bool status = psDBCreateTable(dbh, PSTAMPDATASTORE_TABLE_NAME, md); … … 24847 24854 } 24848 24855 24849 bool pstampDataStoreInsert(psDB * dbh, psS64 ds_id, const char * uri, const char *lastFileset, const char *state)24856 bool pstampDataStoreInsert(psDB * dbh, psS64 ds_id, const char *state, const char *lastFileset, const char *outProduct, const char *uri) 24850 24857 { 24851 24858 psMetadata *md = psMetadataAlloc(); … … 24855 24862 return false; 24856 24863 } 24864 if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, state)) { 24865 psError(PS_ERR_UNKNOWN, false, "failed to add item state"); 24866 psFree(md); 24867 return false; 24868 } 24869 if (!psMetadataAdd(md, PS_LIST_TAIL, "lastFileset", PS_DATA_STRING, NULL, lastFileset)) { 24870 psError(PS_ERR_UNKNOWN, false, "failed to add item lastFileset"); 24871 psFree(md); 24872 return false; 24873 } 24874 if (!psMetadataAdd(md, PS_LIST_TAIL, "outProduct", PS_DATA_STRING, NULL, outProduct)) { 24875 psError(PS_ERR_UNKNOWN, false, "failed to add item outProduct"); 24876 psFree(md); 24877 return false; 24878 } 24857 24879 if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, uri)) { 24858 24880 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); 24859 psFree(md);24860 return false;24861 }24862 if (!psMetadataAdd(md, PS_LIST_TAIL, "lastFileset", PS_DATA_STRING, NULL, lastFileset)) {24863 psError(PS_ERR_UNKNOWN, false, "failed to add item lastFileset");24864 psFree(md);24865 return false;24866 }24867 if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, state)) {24868 psError(PS_ERR_UNKNOWN, false, "failed to add item state");24869 24881 psFree(md); 24870 24882 return false; … … 24893 24905 bool pstampDataStoreInsertObject(psDB *dbh, pstampDataStoreRow *object) 24894 24906 { 24895 return pstampDataStoreInsert(dbh, object->ds_id, object-> uri, object->lastFileset, object->state);24907 return pstampDataStoreInsert(dbh, object->ds_id, object->state, object->lastFileset, object->outProduct, object->uri); 24896 24908 } 24897 24909 … … 24971 24983 return false; 24972 24984 } 24985 if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, object->state)) { 24986 psError(PS_ERR_UNKNOWN, false, "failed to add item state"); 24987 psFree(md); 24988 return false; 24989 } 24990 if (!psMetadataAdd(md, PS_LIST_TAIL, "lastFileset", PS_DATA_STRING, NULL, object->lastFileset)) { 24991 psError(PS_ERR_UNKNOWN, false, "failed to add item lastFileset"); 24992 psFree(md); 24993 return false; 24994 } 24995 if (!psMetadataAdd(md, PS_LIST_TAIL, "outProduct", PS_DATA_STRING, NULL, object->outProduct)) { 24996 psError(PS_ERR_UNKNOWN, false, "failed to add item outProduct"); 24997 psFree(md); 24998 return false; 24999 } 24973 25000 if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, object->uri)) { 24974 25001 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); … … 24976 25003 return false; 24977 25004 } 24978 if (!psMetadataAdd(md, PS_LIST_TAIL, "lastFileset", PS_DATA_STRING, NULL, object->lastFileset)) {24979 psError(PS_ERR_UNKNOWN, false, "failed to add item lastFileset");24980 psFree(md);24981 return false;24982 }24983 if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, object->state)) {24984 psError(PS_ERR_UNKNOWN, false, "failed to add item state");24985 psFree(md);24986 return false;24987 }24988 25005 24989 25006 … … 25000 25017 return false; 25001 25018 } 25019 char* state = psMetadataLookupPtr(&status, md, "state"); 25020 if (!status) { 25021 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item state"); 25022 return false; 25023 } 25024 char* lastFileset = psMetadataLookupPtr(&status, md, "lastFileset"); 25025 if (!status) { 25026 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item lastFileset"); 25027 return false; 25028 } 25029 char* outProduct = psMetadataLookupPtr(&status, md, "outProduct"); 25030 if (!status) { 25031 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item outProduct"); 25032 return false; 25033 } 25002 25034 char* uri = psMetadataLookupPtr(&status, md, "uri"); 25003 25035 if (!status) { … … 25005 25037 return false; 25006 25038 } 25007 char* lastFileset = psMetadataLookupPtr(&status, md, "lastFileset"); 25008 if (!status) { 25009 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item lastFileset"); 25010 return false; 25011 } 25012 char* state = psMetadataLookupPtr(&status, md, "state"); 25013 if (!status) { 25014 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item state"); 25015 return false; 25016 } 25017 25018 return pstampDataStoreRowAlloc(ds_id, uri, lastFileset, state); 25039 25040 return pstampDataStoreRowAlloc(ds_id, state, lastFileset, outProduct, uri); 25019 25041 } 25020 25042 psArray *pstampDataStoreSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 25134 25156 static void pstampRequestRowFree(pstampRequestRow *object); 25135 25157 25136 pstampRequestRow *pstampRequestRowAlloc(psS64 req_id, psS64 ds_id, const char *state, const char * uri)25158 pstampRequestRow *pstampRequestRowAlloc(psS64 req_id, psS64 ds_id, const char *state, const char *outFileset, const char *uri) 25137 25159 { 25138 25160 pstampRequestRow *_object; … … 25144 25166 _object->ds_id = ds_id; 25145 25167 _object->state = psStringCopy(state); 25168 _object->outFileset = psStringCopy(outFileset); 25146 25169 _object->uri = psStringCopy(uri); 25147 25170 … … 25152 25175 { 25153 25176 psFree(object->state); 25177 psFree(object->outFileset); 25154 25178 psFree(object->uri); 25155 25179 } … … 25173 25197 return false; 25174 25198 } 25199 if (!psMetadataAdd(md, PS_LIST_TAIL, "outFileset", PS_DATA_STRING, "UNIQUE", "64")) { 25200 psError(PS_ERR_UNKNOWN, false, "failed to add item outFileset"); 25201 psFree(md); 25202 return false; 25203 } 25175 25204 if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, "255")) { 25176 25205 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); … … 25191 25220 } 25192 25221 25193 bool pstampRequestInsert(psDB * dbh, psS64 req_id, psS64 ds_id, const char *state, const char * uri)25222 bool pstampRequestInsert(psDB * dbh, psS64 req_id, psS64 ds_id, const char *state, const char *outFileset, const char *uri) 25194 25223 { 25195 25224 psMetadata *md = psMetadataAlloc(); … … 25206 25235 if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, state)) { 25207 25236 psError(PS_ERR_UNKNOWN, false, "failed to add item state"); 25237 psFree(md); 25238 return false; 25239 } 25240 if (!psMetadataAdd(md, PS_LIST_TAIL, "outFileset", PS_DATA_STRING, NULL, outFileset)) { 25241 psError(PS_ERR_UNKNOWN, false, "failed to add item outFileset"); 25208 25242 psFree(md); 25209 25243 return false; … … 25237 25271 bool pstampRequestInsertObject(psDB *dbh, pstampRequestRow *object) 25238 25272 { 25239 return pstampRequestInsert(dbh, object->req_id, object->ds_id, object->state, object-> uri);25273 return pstampRequestInsert(dbh, object->req_id, object->ds_id, object->state, object->outFileset, object->uri); 25240 25274 } 25241 25275 … … 25325 25359 return false; 25326 25360 } 25361 if (!psMetadataAdd(md, PS_LIST_TAIL, "outFileset", PS_DATA_STRING, NULL, object->outFileset)) { 25362 psError(PS_ERR_UNKNOWN, false, "failed to add item outFileset"); 25363 psFree(md); 25364 return false; 25365 } 25327 25366 if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, object->uri)) { 25328 25367 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); … … 25354 25393 return false; 25355 25394 } 25395 char* outFileset = psMetadataLookupPtr(&status, md, "outFileset"); 25396 if (!status) { 25397 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item outFileset"); 25398 return false; 25399 } 25356 25400 char* uri = psMetadataLookupPtr(&status, md, "uri"); 25357 25401 if (!status) { … … 25360 25404 } 25361 25405 25362 return pstampRequestRowAlloc(req_id, ds_id, state, uri);25406 return pstampRequestRowAlloc(req_id, ds_id, state, outFileset, uri); 25363 25407 } 25364 25408 psArray *pstampRequestSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Note:
See TracChangeset
for help on using the changeset viewer.
