Changeset 10405 for trunk/ippTools/src/pzgetimfiles.c
- Timestamp:
- Dec 1, 2006, 2:31:01 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/pzgetimfiles.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/pzgetimfiles.c
r10119 r10405 215 215 { 216 216 char *query = 217 "CREATE TEMPORARY TABLE incoming (exp_id VARCHAR(64), camera VARCHAR(64), telescope VARCHAR(64), bytes INT, md5sum VARCHAR(32), class VARCHAR(64), class_id VARCHAR(64), uri VARCHAR(255), PRIMARY KEY(exp_id, camera, telescope, class, class_id)) ENGINE=MEMORY";217 "CREATE TEMPORARY TABLE incoming (exp_id VARCHAR(64), camera VARCHAR(64), telescope VARCHAR(64), file_id VARCHAR(64), bytes INT, md5sum VARCHAR(32), class VARCHAR(64), class_id VARCHAR(64), uri VARCHAR(255), PRIMARY KEY(exp_id, camera, telescope, class, class_id)) ENGINE=MEMORY"; 218 218 219 219 if (!p_psDBRunQuery(config->dbh, query)) { … … 230 230 // load the imfiles (files) into the temp table 231 231 { 232 char *query = "INSERT INTO incoming (exp_id, camera, telescope, bytes, md5sum, class, class_id, uri) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";232 char *query = "INSERT INTO incoming (exp_id, camera, telescope, file_id, bytes, md5sum, class, class_id, uri) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"; 233 233 234 234 long inserted = p_psDBRunQueryPrepared(config->dbh, newImfiles, query); … … 303 303 " incoming.bytes," 304 304 " incoming.md5sum," 305 " incoming.file_id," 305 306 " incoming.class," 306 307 " incoming.class_id," … … 569 570 // check that we have the right number of tokens 570 571 // print "# uri fileid bytes md5sum type \n"; 571 if ( psListLength(tokens) !=5) {572 if (!psListLength(tokens) > 5) { 572 573 psError(PS_ERR_UNKNOWN, true, "invalid line format: %s", line); 574 psFree(tokens); 575 psFree(pzPendingImfiles); 576 psFree(lineCursor); 577 psFree(doc); 573 578 return false; 574 579 } … … 577 582 psListIterator *tokenCursor = psListIteratorAlloc(tokens, 0, false); 578 583 char *uri = psListGetAndIncrement(tokenCursor); 579 char * class_id= psListGetAndIncrement(tokenCursor); // fileid584 char *file_id = psListGetAndIncrement(tokenCursor); // fileid 580 585 char *bytes = psListGetAndIncrement(tokenCursor); // bytes 581 586 char *md5sum = psListGetAndIncrement(tokenCursor); // md5sum 582 587 char *class = psListGetAndIncrement(tokenCursor); // type 588 char *class_id = psListGetAndIncrement(tokenCursor); // chipname 583 589 584 590 // create a new metadata to represent this line and it's values … … 600 606 if (!psMetadataAddStr(md, PS_LIST_TAIL, "telescope", 0, NULL, telescope)) { 601 607 psError(PS_ERR_UNKNOWN, false, "failed to add item telescope"); 608 psFree(md); 609 psFree(tokenCursor); 610 psFree(tokens); 611 return NULL; 612 } 613 if (!psMetadataAddStr(md, PS_LIST_TAIL, "file_id", 0, NULL, file_id)) { 614 psError(PS_ERR_UNKNOWN, false, "failed to add item bytes"); 602 615 psFree(md); 603 616 psFree(tokenCursor);
Note:
See TracChangeset
for help on using the changeset viewer.
