Changeset 11077
- Timestamp:
- Jan 12, 2007, 12:25:20 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
-
dbconfig/config.md (modified) (1 diff)
-
ippdb/configure.ac (modified) (1 diff)
-
ippdb/src/ippdb.c (modified) (16 diffs)
-
ippdb/src/ippdb.h (modified) (6 diffs)
-
ippdb/tests/alloc.c (modified) (4 diffs)
-
ippdb/tests/insert.c (modified) (1 diff)
-
ippdb/tests/insertobject.c (modified) (2 diffs)
-
ippdb/tests/metadatafromobject.c (modified) (4 diffs)
-
ippdb/tests/objectfrommetadata.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dbconfig/config.md
r11045 r11077 2 2 pkg_name STR ippdb 3 3 pkg_namespace STR ippdb 4 pkg_version STR 0.0.7 34 pkg_version STR 0.0.74 5 5 END -
trunk/ippdb/configure.ac
r11045 r11077 7 7 AC_PREREQ(2.59) 8 8 9 AC_INIT([ippdb], [0.0.7 3], [pan-starrs.ifa.hawaii.edu])9 AC_INIT([ippdb], [0.0.74], [pan-starrs.ifa.hawaii.edu]) 10 10 AC_CONFIG_SRCDIR([ippdb.pc.in]) 11 11 -
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) -
trunk/ippdb/src/ippdb.h
r11045 r11077 3753 3753 psS32 p3_version; 3754 3754 char *label; 3755 psS16 fault;3756 3755 } p3PendingExpRow; 3757 3756 … … 3765 3764 psS32 p2_version, 3766 3765 psS32 p3_version, 3767 const char *label, 3768 psS16 fault 3766 const char *label 3769 3767 ); 3770 3768 … … 3799 3797 psS32 p2_version, 3800 3798 psS32 p3_version, 3801 const char *label, 3802 psS16 fault 3799 const char *label 3803 3800 ); 3804 3801 … … 3972 3969 psS32 p3_version; 3973 3970 char *label; 3971 psS16 fault; 3974 3972 } p3ProcessedExpRow; 3975 3973 … … 3995 3993 psS32 p2_version, 3996 3994 psS32 p3_version, 3997 const char *label 3995 const char *label, 3996 psS16 fault 3998 3997 ); 3999 3998 … … 4040 4039 psS32 p2_version, 4041 4040 psS32 p3_version, 4042 const char *label 4041 const char *label, 4042 psS16 fault 4043 4043 ); 4044 4044 -
trunk/ippdb/tests/alloc.c
r11045 r11077 696 696 p3PendingExpRow *object; 697 697 698 object = p3PendingExpRowAlloc("a string", -32, -32, "a string" , -16);698 object = p3PendingExpRowAlloc("a string", -32, -32, "a string" ); 699 699 700 700 if (!object) { … … 718 718 exit(EXIT_FAILURE); 719 719 } 720 psFree(object);721 exit(EXIT_FAILURE);722 }723 720 724 721 psFree(object); … … 728 725 p3ProcessedExpRow *object; 729 726 730 object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string" );727 object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string", -16 ); 731 728 732 729 if (!object) { … … 795 792 } 796 793 if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) { 794 psFree(object); 795 exit(EXIT_FAILURE); 796 } 797 797 psFree(object); 798 798 exit(EXIT_FAILURE); -
trunk/ippdb/tests/insert.c
r11045 r11077 268 268 } 269 269 270 if (!p3PendingExpInsert(dbh, "a string", -32, -32, "a string" , -16)) {271 exit(EXIT_FAILURE); 272 } 273 274 psDBCleanup(dbh); 275 } 276 277 { 278 psDB *dbh; 279 280 dbh = psDBInit("localhost", "test", NULL, "test"); 281 if (!dbh) { 282 exit(EXIT_FAILURE); 283 } 284 285 if (!p3ProcessedExpInsert(dbh, "a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string" )) {270 if (!p3PendingExpInsert(dbh, "a string", -32, -32, "a string")) { 271 exit(EXIT_FAILURE); 272 } 273 274 psDBCleanup(dbh); 275 } 276 277 { 278 psDB *dbh; 279 280 dbh = psDBInit("localhost", "test", NULL, "test"); 281 if (!dbh) { 282 exit(EXIT_FAILURE); 283 } 284 285 if (!p3ProcessedExpInsert(dbh, "a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string", -16)) { 286 286 exit(EXIT_FAILURE); 287 287 } -
trunk/ippdb/tests/insertobject.c
r11045 r11077 388 388 } 389 389 390 object = p3PendingExpRowAlloc("a string", -32, -32, "a string" , -16);390 object = p3PendingExpRowAlloc("a string", -32, -32, "a string"); 391 391 if (!object) { 392 392 exit(EXIT_FAILURE); … … 410 410 } 411 411 412 object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string" );412 object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string", -16); 413 413 if (!object) { 414 414 exit(EXIT_FAILURE); -
trunk/ippdb/tests/metadatafromobject.c
r11045 r11077 834 834 bool status; 835 835 836 object = p3PendingExpRowAlloc("a string", -32, -32, "a string" , -16);836 object = p3PendingExpRowAlloc("a string", -32, -32, "a string"); 837 837 if (!object) { 838 838 exit(EXIT_FAILURE); … … 862 862 exit(EXIT_FAILURE); 863 863 } 864 psFree(md);865 exit(EXIT_FAILURE);866 }867 864 868 865 psFree(md); … … 874 871 bool status; 875 872 876 object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string" );873 object = p3ProcessedExpRowAlloc("a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -32, -32, "a string", -16); 877 874 if (!object) { 878 875 exit(EXIT_FAILURE); … … 947 944 } 948 945 if (strncmp(psMetadataLookupPtr(&status, md, "label"), "a string", MAX_STRING_LENGTH)) { 946 psFree(md); 947 exit(EXIT_FAILURE); 948 } 949 949 psFree(md); 950 950 exit(EXIT_FAILURE); -
trunk/ippdb/tests/objectfrommetadata.c
r11045 r11077 1263 1263 exit(EXIT_FAILURE); 1264 1264 } 1265 psFree(md);1266 exit(EXIT_FAILURE);1267 }1268 1265 1269 1266 object = p3PendingExpObjectFromMetadata(md); … … 1291 1288 exit(EXIT_FAILURE); 1292 1289 } 1293 psFree(object);1294 exit(EXIT_FAILURE);1295 }1296 1290 1297 1291 psFree(object); … … 1367 1361 exit(EXIT_FAILURE); 1368 1362 } 1363 psFree(md); 1364 exit(EXIT_FAILURE); 1365 } 1369 1366 1370 1367 object = p3ProcessedExpObjectFromMetadata(md); … … 1437 1434 } 1438 1435 if (strncmp(object->label, "a string", MAX_STRING_LENGTH)) { 1436 psFree(object); 1437 exit(EXIT_FAILURE); 1438 } 1439 1439 psFree(object); 1440 1440 exit(EXIT_FAILURE);
Note:
See TracChangeset
for help on using the changeset viewer.
