Changeset 10989
- Timestamp:
- Jan 8, 2007, 4:08:31 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
-
dbconfig/config.md (modified) (1 diff)
-
dbconfig/tasks.md (modified) (3 diffs)
-
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
r10752 r10989 2 2 pkg_name STR ippdb 3 3 pkg_namespace STR ippdb 4 pkg_version STR 0.0.6 84 pkg_version STR 0.0.69 5 5 END -
trunk/dbconfig/tasks.md
r10327 r10989 1 # $Id: tasks.md,v 1.10 0 2006-12-01 00:45:06jhoblitt Exp $1 # $Id: tasks.md,v 1.101 2007-01-09 02:08:31 jhoblitt Exp $ 2 2 3 3 # this table records all exposure ID ever seen from the summit … … 90 90 exp_type STR 64 91 91 imfiles S32 0 92 fault S16 0 # NOT NULL 92 93 END 93 94 … … 99 100 class_id STR 64 # Primary Key 100 101 uri STR 255 102 fault S16 0 # NOT NULL 101 103 END 102 104 -
trunk/ippdb/configure.ac
r10753 r10989 7 7 AC_PREREQ(2.59) 8 8 9 AC_INIT([ippdb], [0.0.6 8], [pan-starrs.ifa.hawaii.edu])9 AC_INIT([ippdb], [0.0.69], [pan-starrs.ifa.hawaii.edu]) 10 10 AC_CONFIG_SRCDIR([ippdb.pc.in]) 11 11 -
trunk/ippdb/src/ippdb.c
r10753 r10989 2800 2800 static void newExpRowFree(newExpRow *object); 2801 2801 2802 newExpRow *newExpRowAlloc(const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles )2802 newExpRow *newExpRowAlloc(const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles, psS16 fault) 2803 2803 { 2804 2804 newExpRow *_object; … … 2814 2814 _object->exp_type = psStringCopy(exp_type); 2815 2815 _object->imfiles = imfiles; 2816 _object->fault = fault; 2816 2817 2817 2818 return _object; … … 2866 2867 return false; 2867 2868 } 2869 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) { 2870 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 2871 psFree(md); 2872 return false; 2873 } 2868 2874 2869 2875 bool status = psDBCreateTable(dbh, NEWEXP_TABLE_NAME, md); … … 2879 2885 } 2880 2886 2881 bool newExpInsert(psDB * dbh, const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles )2887 bool newExpInsert(psDB * dbh, const char *exp_tag, const char *exp_id, const char *camera, const char *telescope, psTime* dateobs, const char *exp_type, psS32 imfiles, psS16 fault) 2882 2888 { 2883 2889 psMetadata *md = psMetadataAlloc(); … … 2914 2920 if (!psMetadataAdd(md, PS_LIST_TAIL, "imfiles", PS_DATA_S32, NULL, imfiles)) { 2915 2921 psError(PS_ERR_UNKNOWN, false, "failed to add item imfiles"); 2922 psFree(md); 2923 return false; 2924 } 2925 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) { 2926 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 2916 2927 psFree(md); 2917 2928 return false; … … 2940 2951 bool newExpInsertObject(psDB *dbh, newExpRow *object) 2941 2952 { 2942 return newExpInsert(dbh, object->exp_tag, object->exp_id, object->camera, object->telescope, object->dateobs, object->exp_type, object->imfiles );2953 return newExpInsert(dbh, object->exp_tag, object->exp_id, object->camera, object->telescope, object->dateobs, object->exp_type, object->imfiles, object->fault); 2943 2954 } 2944 2955 … … 3048 3059 return false; 3049 3060 } 3061 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) { 3062 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 3063 psFree(md); 3064 return false; 3065 } 3050 3066 3051 3067 … … 3092 3108 return false; 3093 3109 } 3094 3095 return newExpRowAlloc(exp_tag, exp_id, camera, telescope, dateobs, exp_type, imfiles); 3110 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 3111 if (!status) { 3112 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault"); 3113 return false; 3114 } 3115 3116 return newExpRowAlloc(exp_tag, exp_id, camera, telescope, dateobs, exp_type, imfiles, fault); 3096 3117 } 3097 3118 psArray *newExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 3205 3226 static void newImfileRowFree(newImfileRow *object); 3206 3227 3207 newImfileRow *newImfileRowAlloc(const char *exp_tag, const char *class, const char *class_id, const char *uri )3228 newImfileRow *newImfileRowAlloc(const char *exp_tag, const char *class, const char *class_id, const char *uri, psS16 fault) 3208 3229 { 3209 3230 newImfileRow *_object; … … 3216 3237 _object->class_id = psStringCopy(class_id); 3217 3238 _object->uri = psStringCopy(uri); 3239 _object->fault = fault; 3218 3240 3219 3241 return _object; … … 3251 3273 return false; 3252 3274 } 3275 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, "NOT NULL", 0)) { 3276 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 3277 psFree(md); 3278 return false; 3279 } 3253 3280 3254 3281 bool status = psDBCreateTable(dbh, NEWIMFILE_TABLE_NAME, md); … … 3264 3291 } 3265 3292 3266 bool newImfileInsert(psDB * dbh, const char *exp_tag, const char *class, const char *class_id, const char *uri )3293 bool newImfileInsert(psDB * dbh, const char *exp_tag, const char *class, const char *class_id, const char *uri, psS16 fault) 3267 3294 { 3268 3295 psMetadata *md = psMetadataAlloc(); … … 3284 3311 if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, uri)) { 3285 3312 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); 3313 psFree(md); 3314 return false; 3315 } 3316 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, fault)) { 3317 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 3286 3318 psFree(md); 3287 3319 return false; … … 3310 3342 bool newImfileInsertObject(psDB *dbh, newImfileRow *object) 3311 3343 { 3312 return newImfileInsert(dbh, object->exp_tag, object->class, object->class_id, object->uri );3344 return newImfileInsert(dbh, object->exp_tag, object->class, object->class_id, object->uri, object->fault); 3313 3345 } 3314 3346 … … 3403 3435 return false; 3404 3436 } 3437 if (!psMetadataAdd(md, PS_LIST_TAIL, "fault", PS_DATA_S16, NULL, object->fault)) { 3438 psError(PS_ERR_UNKNOWN, false, "failed to add item fault"); 3439 psFree(md); 3440 return false; 3441 } 3405 3442 3406 3443 … … 3432 3469 return false; 3433 3470 } 3434 3435 return newImfileRowAlloc(exp_tag, class, class_id, uri); 3471 psS16 fault = psMetadataLookupS16(&status, md, "fault"); 3472 if (!status) { 3473 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item fault"); 3474 return false; 3475 } 3476 3477 return newImfileRowAlloc(exp_tag, class, class_id, uri, fault); 3436 3478 } 3437 3479 psArray *newImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) -
trunk/ippdb/src/ippdb.h
r10753 r10989 1590 1590 char *exp_type; 1591 1591 psS32 imfiles; 1592 psS16 fault; 1592 1593 } newExpRow; 1593 1594 … … 1604 1605 psTime* dateobs, 1605 1606 const char *exp_type, 1606 psS32 imfiles 1607 psS32 imfiles, 1608 psS16 fault 1607 1609 ); 1608 1610 … … 1640 1642 psTime* dateobs, 1641 1643 const char *exp_type, 1642 psS32 imfiles 1644 psS32 imfiles, 1645 psS16 fault 1643 1646 ); 1644 1647 … … 1800 1803 char *class_id; 1801 1804 char *uri; 1805 psS16 fault; 1802 1806 } newImfileRow; 1803 1807 … … 1811 1815 const char *class, 1812 1816 const char *class_id, 1813 const char *uri 1817 const char *uri, 1818 psS16 fault 1814 1819 ); 1815 1820 … … 1844 1849 const char *class, 1845 1850 const char *class_id, 1846 const char *uri 1851 const char *uri, 1852 psS16 fault 1847 1853 ); 1848 1854 -
trunk/ippdb/tests/alloc.c
r10753 r10989 244 244 newExpRow *object; 245 245 246 object = newExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32 );246 object = newExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, -16 ); 247 247 248 248 if (!object) { … … 277 277 exit(EXIT_FAILURE); 278 278 } 279 psFree(object); 280 exit(EXIT_FAILURE); 281 } 279 282 280 283 psFree(object); … … 284 287 newImfileRow *object; 285 288 286 object = newImfileRowAlloc("a string", "a string", "a string", "a string" );289 object = newImfileRowAlloc("a string", "a string", "a string", "a string", -16 ); 287 290 288 291 if (!object) { … … 303 306 } 304 307 if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) { 308 psFree(object); 309 exit(EXIT_FAILURE); 310 } 305 311 psFree(object); 306 312 exit(EXIT_FAILURE); -
trunk/ippdb/tests/insert.c
r10753 r10989 118 118 } 119 119 120 if (!newExpInsert(dbh, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32 )) {121 exit(EXIT_FAILURE); 122 } 123 124 psDBCleanup(dbh); 125 } 126 127 { 128 psDB *dbh; 129 130 dbh = psDBInit("localhost", "test", NULL, "test"); 131 if (!dbh) { 132 exit(EXIT_FAILURE); 133 } 134 135 if (!newImfileInsert(dbh, "a string", "a string", "a string", "a string" )) {120 if (!newExpInsert(dbh, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, -16)) { 121 exit(EXIT_FAILURE); 122 } 123 124 psDBCleanup(dbh); 125 } 126 127 { 128 psDB *dbh; 129 130 dbh = psDBInit("localhost", "test", NULL, "test"); 131 if (!dbh) { 132 exit(EXIT_FAILURE); 133 } 134 135 if (!newImfileInsert(dbh, "a string", "a string", "a string", "a string", -16)) { 136 136 exit(EXIT_FAILURE); 137 137 } -
trunk/ippdb/tests/insertobject.c
r10753 r10989 168 168 } 169 169 170 object = newExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32 );170 object = newExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, -16); 171 171 if (!object) { 172 172 exit(EXIT_FAILURE); … … 190 190 } 191 191 192 object = newImfileRowAlloc("a string", "a string", "a string", "a string" );192 object = newImfileRowAlloc("a string", "a string", "a string", "a string", -16); 193 193 if (!object) { 194 194 exit(EXIT_FAILURE); -
trunk/ippdb/tests/metadatafromobject.c
r10753 r10989 302 302 bool status; 303 303 304 object = newExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32 );304 object = newExpRowAlloc("a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", -32, -16); 305 305 if (!object) { 306 306 exit(EXIT_FAILURE); … … 341 341 exit(EXIT_FAILURE); 342 342 } 343 psFree(md); 344 exit(EXIT_FAILURE); 345 } 343 346 344 347 psFree(md); … … 350 353 bool status; 351 354 352 object = newImfileRowAlloc("a string", "a string", "a string", "a string" );355 object = newImfileRowAlloc("a string", "a string", "a string", "a string", -16); 353 356 if (!object) { 354 357 exit(EXIT_FAILURE); … … 375 378 } 376 379 if (strncmp(psMetadataLookupPtr(&status, md, "uri"), "a string", MAX_STRING_LENGTH)) { 380 psFree(md); 381 exit(EXIT_FAILURE); 382 } 377 383 psFree(md); 378 384 exit(EXIT_FAILURE); -
trunk/ippdb/tests/objectfrommetadata.c
r10753 r10989 450 450 exit(EXIT_FAILURE); 451 451 } 452 psFree(md); 453 exit(EXIT_FAILURE); 454 } 452 455 453 456 object = newExpObjectFromMetadata(md); … … 486 489 exit(EXIT_FAILURE); 487 490 } 491 psFree(object); 492 exit(EXIT_FAILURE); 493 } 488 494 489 495 psFree(object); … … 511 517 exit(EXIT_FAILURE); 512 518 } 519 psFree(md); 520 exit(EXIT_FAILURE); 521 } 513 522 514 523 object = newImfileObjectFromMetadata(md); … … 533 542 } 534 543 if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) { 544 psFree(object); 545 exit(EXIT_FAILURE); 546 } 535 547 psFree(object); 536 548 exit(EXIT_FAILURE);
Note:
See TracChangeset
for help on using the changeset viewer.
