Changeset 11077 for trunk/ippdb/src/ippdb.c
- Timestamp:
- Jan 12, 2007, 12:25:20 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippdb/src/ippdb.c (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/src/ippdb.c
r11045 r11077 7084 7084 static void p3PendingExpRowFree(p3PendingExpRow *object); 7085 7085 7086 p3PendingExpRow *p3PendingExpRowAlloc(const char *exp_tag, psS32 p2_version, psS32 p3_version, const char *label , psS16 fault)7086 p3PendingExpRow *p3PendingExpRowAlloc(const char *exp_tag, psS32 p2_version, psS32 p3_version, const char *label) 7087 7087 { 7088 7088 p3PendingExpRow *_object; … … 7095 7095 _object->p3_version = p3_version; 7096 7096 _object->label = psStringCopy(label); 7097 _object->fault = fault;7098 7097 7099 7098 return _object; … … 7129 7128 return false; 7130 7129 } 7131 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) {7132 psError(PS_ERR_UNKNOWN, false, "failed to add item fault");7133 psFree(md);7134 return false;7135 }7136 7130 7137 7131 bool status = psDBCreateTable(dbh, P3PENDINGEXP_TABLE_NAME, md); … … 7147 7141 } 7148 7142 7149 bool p3PendingExpInsert(psDB * dbh, const char *exp_tag, psS32 p2_version, psS32 p3_version, const char *label , psS16 fault)7143 bool p3PendingExpInsert(psDB * dbh, const char *exp_tag, psS32 p2_version, psS32 p3_version, const char *label) 7150 7144 { 7151 7145 psMetadata *md = psMetadataAlloc(); … … 7167 7161 if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, NULL, label)) { 7168 7162 psError(PS_ERR_UNKNOWN, false, "failed to add item label"); 7169 psFree(md);7170 return false;7171 }7172 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) {7173 psError(PS_ERR_UNKNOWN, false, "failed to add item fault");7174 7163 psFree(md); 7175 7164 return false; … … 7198 7187 bool p3PendingExpInsertObject(psDB *dbh, p3PendingExpRow *object) 7199 7188 { 7200 return p3PendingExpInsert(dbh, object->exp_tag, object->p2_version, object->p3_version, object->label , object->fault);7189 return p3PendingExpInsert(dbh, object->exp_tag, object->p2_version, object->p3_version, object->label); 7201 7190 } 7202 7191 … … 7291 7280 return false; 7292 7281 } 7293 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) {7294 psError(PS_ERR_UNKNOWN, false, "failed to add item fault");7295 psFree(md);7296 return false;7297 }7298 7282 7299 7283 … … 7325 7309 return false; 7326 7310 } 7327 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 7328 if (!status) { 7329 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault"); 7330 return false; 7331 } 7332 7333 return p3PendingExpRowAlloc(exp_tag, p2_version, p3_version, label, fault); 7311 7312 return p3PendingExpRowAlloc(exp_tag, p2_version, p3_version, label); 7334 7313 } 7335 7314 psArray *p3PendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 7443 7422 static void p3ProcessedExpRowFree(p3ProcessedExpRow *object); 7444 7423 7445 p3ProcessedExpRow *p3ProcessedExpRowAlloc(const char *exp_tag, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psS32 nastro, const char *b1_uri, const char *b2_uri, psF32 zp_mean, psF32 zp_stdev, psS32 p2_version, psS32 p3_version, const char *label )7424 p3ProcessedExpRow *p3ProcessedExpRowAlloc(const char *exp_tag, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psS32 nastro, const char *b1_uri, const char *b2_uri, psF32 zp_mean, psF32 zp_stdev, psS32 p2_version, psS32 p3_version, const char *label, psS16 fault) 7446 7425 { 7447 7426 p3ProcessedExpRow *_object; … … 7466 7445 _object->p3_version = p3_version; 7467 7446 _object->label = psStringCopy(label); 7447 _object->fault = fault; 7468 7448 7469 7449 return _object; … … 7563 7543 return false; 7564 7544 } 7545 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) { 7546 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 7547 psFree(md); 7548 return false; 7549 } 7565 7550 7566 7551 bool status = psDBCreateTable(dbh, P3PROCESSEDEXP_TABLE_NAME, md); … … 7576 7561 } 7577 7562 7578 bool p3ProcessedExpInsert(psDB * dbh, const char *exp_tag, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psS32 nastro, const char *b1_uri, const char *b2_uri, psF32 zp_mean, psF32 zp_stdev, psS32 p2_version, psS32 p3_version, const char *label )7563 bool p3ProcessedExpInsert(psDB * dbh, const char *exp_tag, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psS32 nastro, const char *b1_uri, const char *b2_uri, psF32 zp_mean, psF32 zp_stdev, psS32 p2_version, psS32 p3_version, const char *label, psS16 fault) 7579 7564 { 7580 7565 psMetadata *md = psMetadataAlloc(); … … 7656 7641 if (!psMetadataAdd(md, PS_LIST_TAIL, "label", PS_DATA_STRING, NULL, label)) { 7657 7642 psError(PS_ERR_UNKNOWN, false, "failed to add item label"); 7643 psFree(md); 7644 return false; 7645 } 7646 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) { 7647 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 7658 7648 psFree(md); 7659 7649 return false; … … 7682 7672 bool p3ProcessedExpInsertObject(psDB *dbh, p3ProcessedExpRow *object) 7683 7673 { 7684 return p3ProcessedExpInsert(dbh, object->exp_tag, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->sigma_ra, object->sigma_dec, object->nastro, object->b1_uri, object->b2_uri, object->zp_mean, object->zp_stdev, object->p2_version, object->p3_version, object->label );7674 return p3ProcessedExpInsert(dbh, object->exp_tag, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->sigma_ra, object->sigma_dec, object->nastro, object->b1_uri, object->b2_uri, object->zp_mean, object->zp_stdev, object->p2_version, object->p3_version, object->label, object->fault); 7685 7675 } 7686 7676 … … 7835 7825 return false; 7836 7826 } 7827 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) { 7828 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 7829 psFree(md); 7830 return false; 7831 } 7837 7832 7838 7833 … … 7924 7919 return false; 7925 7920 } 7926 7927 return p3ProcessedExpRowAlloc(exp_tag, uri, recipe, bg, bg_stdev, bg_mean_stdev, sigma_ra, sigma_dec, nastro, b1_uri, b2_uri, zp_mean, zp_stdev, p2_version, p3_version, label); 7921 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 7922 if (!status) { 7923 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault"); 7924 return false; 7925 } 7926 7927 return p3ProcessedExpRowAlloc(exp_tag, uri, recipe, bg, bg_stdev, bg_mean_stdev, sigma_ra, sigma_dec, nastro, b1_uri, b2_uri, zp_mean, zp_stdev, p2_version, p3_version, label, fault); 7928 7928 } 7929 7929 psArray *p3ProcessedExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Note:
See TracChangeset
for help on using the changeset viewer.
