Changeset 13994 for branches/backtrack/ippTools/src/camtool.c
- Timestamp:
- Jul 2, 2007, 3:46:36 PM (19 years ago)
- File:
-
- 1 edited
-
branches/backtrack/ippTools/src/camtool.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/backtrack/ippTools/src/camtool.c
r13937 r13994 203 203 204 204 // find the chipProcessedExp exposures that we want to queue up. 205 psString query = psStringCopy("SELECT * FROM chipProcessedExp"); 205 // psString query = psStringCopy("SELECT * FROM chipRun WHERE chipRun.state = 'stop'"); 206 psString query = pxDataGet("camtool_find_chip_id.sql"); 207 if (!query) { 208 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 209 return false; 210 } 206 211 207 212 if (where) { 208 psString whereClause = psDBGenerateWhereSQL(where, " chipProcessedExp");213 psString whereClause = psDBGenerateWhereSQL(where, ""); 209 214 psFree(where); 210 215 psStringAppend(&query, " %s", whereClause); … … 245 250 psMetadata *md = output->data[i]; 246 251 247 chip ProcessedExpRow *row = chipProcessedExpObjectFromMetadata(md);252 chipRunRow *row = chipRunObjectFromMetadata(md); 248 253 if (!row) { 249 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into chip ProcessedExp");254 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into chipRun"); 250 255 psFree(output); 251 256 return false; … … 601 606 } 602 607 603 // start a transaction so we don't end up with an exp_tag is both604 // camPendingExp & camProcessedExp605 608 if (!psDBTransaction(config->dbh)) { 606 609 psError(PS_ERR_UNKNOWN, false, "database error"); … … 609 612 } 610 613 611 cam PendingExpRow *pendingRow = camPendingExpObjectFromMetadata(output->data[0]);614 camRunRow *pendingRow = camRunObjectFromMetadata(output->data[0]); 612 615 psFree(output); 613 616 // create a new camProcessedImfile object … … 615 618 pendingRow->cam_id, 616 619 pendingRow->chip_id, 617 pendingRow->workdir,618 pendingRow->label,619 pendingRow->reduction,620 pendingRow->expgroup,621 pendingRow->dvodb,622 620 uri, 623 621 bg, … … 637 635 code 638 636 ); 637 psFree(pendingRow); 639 638 640 639 // insert the new row into the camProcessedImfile table … … 646 645 psError(PS_ERR_UNKNOWN, false, "database error"); 647 646 psFree(row); 648 psFree(pendingRow); 649 return false; 650 } 647 return false; 648 } 649 650 // since there is only one exp per 'run' set camRun.state = 'stop' 651 if (!pxcamRunSetState(config, row->cam_id, "stop")) { 652 psError(PS_ERR_UNKNOWN, false, "failed to change camRun.state for cam_id: %" PRId64, row->cam_id); 653 psFree(row); 654 return false; 655 } 656 651 657 psFree(row); 652 658 653 // delete the camPendingExp row from the database654 if (!camPendingExpDeleteObject(config->dbh, pendingRow)) {655 // rollback656 if (!psDBRollback(config->dbh)) {657 psError(PS_ERR_UNKNOWN, false, "database error");658 }659 psError(PS_ERR_UNKNOWN, false, "database error");660 psFree(pendingRow);661 return false;662 }663 664 psFree(pendingRow);665 666 // point of no return for camPendingExp -> camProcessedExp667 659 if (!psDBCommit(config->dbh)) { 668 660 psError(PS_ERR_UNKNOWN, false, "database error");
Note:
See TracChangeset
for help on using the changeset viewer.
