Changeset 17142 for trunk/ippdb/src/ippdb.c
- Timestamp:
- Mar 25, 2008, 12:32:53 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippdb/src/ippdb.c (modified) (28 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/src/ippdb.c
r16731 r17142 9503 9503 static void warpRunRowFree(warpRunRow *object); 9504 9504 9505 warpRunRow *warpRunRowAlloc(psS64 warp_id, psS64 cam_id, const char *mode, const char *state, const char *workdir, const char *workdir_state, const char * dvodb, const char *tess_id, const char *end_stage, psTime* registered, bool magiced)9505 warpRunRow *warpRunRowAlloc(psS64 warp_id, psS64 cam_id, const char *mode, const char *state, const char *workdir, const char *workdir_state, const char *label, const char *dvodb, const char *tess_id, const char *end_stage, psTime* registered, bool magiced) 9506 9506 { 9507 9507 warpRunRow *_object; … … 9516 9516 _object->workdir = psStringCopy(workdir); 9517 9517 _object->workdir_state = psStringCopy(workdir_state); 9518 _object->label = psStringCopy(label); 9518 9519 _object->dvodb = psStringCopy(dvodb); 9519 9520 _object->tess_id = psStringCopy(tess_id); … … 9531 9532 psFree(object->workdir); 9532 9533 psFree(object->workdir_state); 9534 psFree(object->label); 9533 9535 psFree(object->dvodb); 9534 9536 psFree(object->tess_id); … … 9570 9572 return false; 9571 9573 } 9574 if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, "key", "64")) { 9575 psError(PS_ERR_UNKNOWN, false, "failed to add item label"); 9576 psFree(md); 9577 return false; 9578 } 9572 9579 if (!psMetadataAdd(md, PS_LIST_TAIL, "dvodb", PS_DATA_STRING, NULL, "255")) { 9573 9580 psError(PS_ERR_UNKNOWN, false, "failed to add item dvodb"); … … 9608 9615 } 9609 9616 9610 bool warpRunInsert(psDB * dbh, psS64 warp_id, psS64 cam_id, const char *mode, const char *state, const char *workdir, const char *workdir_state, const char * dvodb, const char *tess_id, const char *end_stage, psTime* registered, bool magiced)9617 bool warpRunInsert(psDB * dbh, psS64 warp_id, psS64 cam_id, const char *mode, const char *state, const char *workdir, const char *workdir_state, const char *label, const char *dvodb, const char *tess_id, const char *end_stage, psTime* registered, bool magiced) 9611 9618 { 9612 9619 psMetadata *md = psMetadataAlloc(); … … 9638 9645 if (!psMetadataAdd(md, PS_LIST_TAIL, "workdir_state", PS_DATA_STRING, NULL, workdir_state)) { 9639 9646 psError(PS_ERR_UNKNOWN, false, "failed to add item workdir_state"); 9647 psFree(md); 9648 return false; 9649 } 9650 if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, NULL, label)) { 9651 psError(PS_ERR_UNKNOWN, false, "failed to add item label"); 9640 9652 psFree(md); 9641 9653 return false; … … 9689 9701 bool warpRunInsertObject(psDB *dbh, warpRunRow *object) 9690 9702 { 9691 return warpRunInsert(dbh, object->warp_id, object->cam_id, object->mode, object->state, object->workdir, object->workdir_state, object-> dvodb, object->tess_id, object->end_stage, object->registered, object->magiced);9703 return warpRunInsert(dbh, object->warp_id, object->cam_id, object->mode, object->state, object->workdir, object->workdir_state, object->label, object->dvodb, object->tess_id, object->end_stage, object->registered, object->magiced); 9692 9704 } 9693 9705 … … 9792 9804 return false; 9793 9805 } 9806 if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, NULL, object->label)) { 9807 psError(PS_ERR_UNKNOWN, false, "failed to add item label"); 9808 psFree(md); 9809 return false; 9810 } 9794 9811 if (!psMetadataAdd(md, PS_LIST_TAIL, "dvodb", PS_DATA_STRING, NULL, object->dvodb)) { 9795 9812 psError(PS_ERR_UNKNOWN, false, "failed to add item dvodb"); … … 9856 9873 return false; 9857 9874 } 9875 char* label = psMetadataLookupPtr(&status, md, "label"); 9876 if (!status) { 9877 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item label"); 9878 return false; 9879 } 9858 9880 char* dvodb = psMetadataLookupPtr(&status, md, "dvodb"); 9859 9881 if (!status) { … … 9882 9904 } 9883 9905 9884 return warpRunRowAlloc(warp_id, cam_id, mode, state, workdir, workdir_state, dvodb, tess_id, end_stage, registered, magiced);9906 return warpRunRowAlloc(warp_id, cam_id, mode, state, workdir, workdir_state, label, dvodb, tess_id, end_stage, registered, magiced); 9885 9907 } 9886 9908 psArray *warpRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 24898 24920 static void pstampRequestRowFree(pstampRequestRow *object); 24899 24921 24900 pstampRequestRow *pstampRequestRowAlloc(psS64 req_id, psS64 ds_id, const char *state, const char *outFileset, const char *uri )24922 pstampRequestRow *pstampRequestRowAlloc(psS64 req_id, psS64 ds_id, const char *state, const char *outFileset, const char *uri, psS16 resultsFile) 24901 24923 { 24902 24924 pstampRequestRow *_object; … … 24910 24932 _object->outFileset = psStringCopy(outFileset); 24911 24933 _object->uri = psStringCopy(uri); 24934 _object->resultsFile = resultsFile; 24912 24935 24913 24936 return _object; … … 24949 24972 return false; 24950 24973 } 24974 if (!psMetadataAdd(md, PS_LIST_TAIL, "resultsFile", PS_DATA_S16, NULL, 0)) { 24975 psError(PS_ERR_UNKNOWN, false, "failed to add item resultsFile"); 24976 psFree(md); 24977 return false; 24978 } 24951 24979 24952 24980 bool status = psDBCreateTable(dbh, PSTAMPREQUEST_TABLE_NAME, md); … … 24962 24990 } 24963 24991 24964 bool pstampRequestInsert(psDB * dbh, psS64 req_id, psS64 ds_id, const char *state, const char *outFileset, const char *uri )24992 bool pstampRequestInsert(psDB * dbh, psS64 req_id, psS64 ds_id, const char *state, const char *outFileset, const char *uri, psS16 resultsFile) 24965 24993 { 24966 24994 psMetadata *md = psMetadataAlloc(); … … 24987 25015 if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, uri)) { 24988 25016 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); 25017 psFree(md); 25018 return false; 25019 } 25020 if (!psMetadataAdd(md, PS_LIST_TAIL, "resultsFile", PS_DATA_S16, NULL, resultsFile)) { 25021 psError(PS_ERR_UNKNOWN, false, "failed to add item resultsFile"); 24989 25022 psFree(md); 24990 25023 return false; … … 25013 25046 bool pstampRequestInsertObject(psDB *dbh, pstampRequestRow *object) 25014 25047 { 25015 return pstampRequestInsert(dbh, object->req_id, object->ds_id, object->state, object->outFileset, object->uri );25048 return pstampRequestInsert(dbh, object->req_id, object->ds_id, object->state, object->outFileset, object->uri, object->resultsFile); 25016 25049 } 25017 25050 … … 25111 25144 return false; 25112 25145 } 25146 if (!psMetadataAdd(md, PS_LIST_TAIL, "resultsFile", PS_DATA_S16, NULL, object->resultsFile)) { 25147 psError(PS_ERR_UNKNOWN, false, "failed to add item resultsFile"); 25148 psFree(md); 25149 return false; 25150 } 25113 25151 25114 25152 … … 25145 25183 return false; 25146 25184 } 25147 25148 return pstampRequestRowAlloc(req_id, ds_id, state, outFileset, uri); 25185 psS16 resultsFile = psMetadataLookupS16(&status, md, "resultsFile"); 25186 if (!status) { 25187 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item resultsFile"); 25188 return false; 25189 } 25190 25191 return pstampRequestRowAlloc(req_id, ds_id, state, outFileset, uri, resultsFile); 25149 25192 } 25150 25193 psArray *pstampRequestSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 25264 25307 static void pstampJobRowFree(pstampJobRow *object); 25265 25308 25266 pstampJobRow *pstampJobRowAlloc(psS64 job_id, psS64 req_id, const char *state, psS32 result, const char *uri, const char *outputBase, const char *args)25309 pstampJobRow *pstampJobRowAlloc(psS64 job_id, psS64 req_id, const char *state, const char *jobType, psS32 result, const char *uri, const char *outputBase, const char *args) 25267 25310 { 25268 25311 pstampJobRow *_object; … … 25274 25317 _object->req_id = req_id; 25275 25318 _object->state = psStringCopy(state); 25319 _object->jobType = psStringCopy(jobType); 25276 25320 _object->result = result; 25277 25321 _object->uri = psStringCopy(uri); … … 25285 25329 { 25286 25330 psFree(object->state); 25331 psFree(object->jobType); 25287 25332 psFree(object->uri); 25288 25333 psFree(object->outputBase); … … 25308 25353 return false; 25309 25354 } 25355 if (!psMetadataAdd(md, PS_LIST_TAIL, "jobType", PS_DATA_STRING, NULL, "16")) { 25356 psError(PS_ERR_UNKNOWN, false, "failed to add item jobType"); 25357 psFree(md); 25358 return false; 25359 } 25310 25360 if (!psMetadataAdd(md, PS_LIST_TAIL, "result", PS_DATA_S32, NULL, 0)) { 25311 25361 psError(PS_ERR_UNKNOWN, false, "failed to add item result"); … … 25341 25391 } 25342 25392 25343 bool pstampJobInsert(psDB * dbh, psS64 job_id, psS64 req_id, const char *state, psS32 result, const char *uri, const char *outputBase, const char *args)25393 bool pstampJobInsert(psDB * dbh, psS64 job_id, psS64 req_id, const char *state, const char *jobType, psS32 result, const char *uri, const char *outputBase, const char *args) 25344 25394 { 25345 25395 psMetadata *md = psMetadataAlloc(); … … 25356 25406 if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, state)) { 25357 25407 psError(PS_ERR_UNKNOWN, false, "failed to add item state"); 25408 psFree(md); 25409 return false; 25410 } 25411 if (!psMetadataAdd(md, PS_LIST_TAIL, "jobType", PS_DATA_STRING, NULL, jobType)) { 25412 psError(PS_ERR_UNKNOWN, false, "failed to add item jobType"); 25358 25413 psFree(md); 25359 25414 return false; … … 25402 25457 bool pstampJobInsertObject(psDB *dbh, pstampJobRow *object) 25403 25458 { 25404 return pstampJobInsert(dbh, object->job_id, object->req_id, object->state, object-> result, object->uri, object->outputBase, object->args);25459 return pstampJobInsert(dbh, object->job_id, object->req_id, object->state, object->jobType, object->result, object->uri, object->outputBase, object->args); 25405 25460 } 25406 25461 … … 25490 25545 return false; 25491 25546 } 25547 if (!psMetadataAdd(md, PS_LIST_TAIL, "jobType", PS_DATA_STRING, NULL, object->jobType)) { 25548 psError(PS_ERR_UNKNOWN, false, "failed to add item jobType"); 25549 psFree(md); 25550 return false; 25551 } 25492 25552 if (!psMetadataAdd(md, PS_LIST_TAIL, "result", PS_DATA_S32, NULL, object->result)) { 25493 25553 psError(PS_ERR_UNKNOWN, false, "failed to add item result"); … … 25534 25594 return false; 25535 25595 } 25596 char* jobType = psMetadataLookupPtr(&status, md, "jobType"); 25597 if (!status) { 25598 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item jobType"); 25599 return false; 25600 } 25536 25601 psS32 result = psMetadataLookupS32(&status, md, "result"); 25537 25602 if (!status) { … … 25555 25620 } 25556 25621 25557 return pstampJobRowAlloc(job_id, req_id, state, result, uri, outputBase, args);25622 return pstampJobRowAlloc(job_id, req_id, state, jobType, result, uri, outputBase, args); 25558 25623 } 25559 25624 psArray *pstampJobSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Note:
See TracChangeset
for help on using the changeset viewer.
