Changeset 9970 for trunk/ippdb/src/ippdb.c
- Timestamp:
- Nov 13, 2006, 5:15:56 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippdb/src/ippdb.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/src/ippdb.c
r9796 r9970 234 234 static void summitExpRowFree(summitExpRow *object); 235 235 236 summitExpRow *summitExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, const char *exp_type, const char *uri)236 summitExpRow *summitExpRowAlloc(const char *exp_id, const char *camera, const char *telescope, psTime* time, const char *exp_type, const char *uri) 237 237 { 238 238 summitExpRow *_object; … … 244 244 _object->camera = psStringCopy(camera); 245 245 _object->telescope = psStringCopy(telescope); 246 _object->time = psTimeCopy(time); 246 247 _object->exp_type = psStringCopy(exp_type); 247 248 _object->uri = psStringCopy(uri); … … 255 256 psFree(object->camera); 256 257 psFree(object->telescope); 258 psFree(object->time); 257 259 psFree(object->exp_type); 258 260 psFree(object->uri); … … 277 279 return false; 278 280 } 281 psTime* time = psTimeFromISO("", PS_TIME_UTC); 282 if (!psMetadataAdd(md, PS_LIST_TAIL, "time", PS_DATA_TIME, NULL, time)) { 283 psFree(time); 284 psError(PS_ERR_UNKNOWN, false, "failed to add item time"); 285 psFree(md); 286 return false; 287 } 288 psFree(time); 279 289 if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_type", PS_DATA_STRING, NULL, "64")) { 280 290 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_type"); … … 300 310 } 301 311 302 bool summitExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, const char *exp_type, const char *uri)312 bool summitExpInsert(psDB * dbh, const char *exp_id, const char *camera, const char *telescope, psTime* time, const char *exp_type, const char *uri) 303 313 { 304 314 psMetadata *md = psMetadataAlloc(); … … 315 325 if (!psMetadataAdd(md, PS_LIST_TAIL, "telescope", PS_DATA_STRING, NULL, telescope)) { 316 326 psError(PS_ERR_UNKNOWN, false, "failed to add item telescope"); 327 psFree(md); 328 return false; 329 } 330 if (!psMetadataAdd(md, PS_LIST_TAIL, "time", PS_DATA_TIME, NULL, time)) { 331 psError(PS_ERR_UNKNOWN, false, "failed to add item time"); 317 332 psFree(md); 318 333 return false; … … 351 366 bool summitExpInsertObject(psDB *dbh, summitExpRow *object) 352 367 { 353 return summitExpInsert(dbh, object->exp_id, object->camera, object->telescope, object-> exp_type, object->uri);368 return summitExpInsert(dbh, object->exp_id, object->camera, object->telescope, object->time, object->exp_type, object->uri); 354 369 } 355 370 … … 439 454 return false; 440 455 } 456 if (!psMetadataAdd(md, PS_LIST_TAIL, "time", PS_DATA_TIME, NULL, object->time)) { 457 psError(PS_ERR_UNKNOWN, false, "failed to add item time"); 458 psFree(md); 459 return false; 460 } 441 461 if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_type", PS_DATA_STRING, NULL, object->exp_type)) { 442 462 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_type"); … … 473 493 return false; 474 494 } 495 psTime* time = psMetadataLookupPtr(&status, md, "time"); 496 if (!status) { 497 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item time"); 498 return false; 499 } 475 500 char* exp_type = psMetadataLookupPtr(&status, md, "exp_type"); 476 501 if (!status) { … … 484 509 } 485 510 486 return summitExpRowAlloc(exp_id, camera, telescope, exp_type, uri);511 return summitExpRowAlloc(exp_id, camera, telescope, time, exp_type, uri); 487 512 } 488 513 psArray *summitExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Note:
See TracChangeset
for help on using the changeset viewer.
