Changeset 11030 for trunk/ippdb/src/ippdb.c
- Timestamp:
- Jan 11, 2007, 11:59:35 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippdb/src/ippdb.c (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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)
Note:
See TracChangeset
for help on using the changeset viewer.
