Changeset 19522 for trunk/ippTools/src/warptool.c
- Timestamp:
- Sep 11, 2008, 3:25:25 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/warptool.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/warptool.c
r19416 r19522 50 50 static bool pendingcleanupwarpMode(pxConfig *config); 51 51 static bool donecleanupMode(pxConfig *config); 52 static bool tocleanedskyfileMode(pxConfig *config); 53 static bool topurgedskyfileMode(pxConfig *config); 54 static bool tofullskyfileMode(pxConfig *config); 55 static bool updateskyfileMode(pxConfig *config); 52 56 53 57 static bool parseAndInsertSkyCellMap(pxConfig *config, const char *mapfile); … … 91 95 MODECASE(WARPTOOL_MODE_PENDINGCLEANUPSKYFILE, pendingcleanupwarpMode); 92 96 MODECASE(WARPTOOL_MODE_DONECLEANUP, donecleanupMode); 97 MODECASE(WARPTOOL_MODE_TOCLEANEDSKYFILE, tocleanedskyfileMode); 98 MODECASE(WARPTOOL_MODE_TOPURGEDSKYFILE, topurgedskyfileMode); 99 MODECASE(WARPTOOL_MODE_TOFULLSKYFILE, tofullskyfileMode); 100 MODECASE(WARPTOOL_MODE_UPDATESKYFILE, updateskyfileMode); 93 101 94 102 default: … … 1502 1510 return true; 1503 1511 } 1512 1513 // update warpSkyfile.data_state to given value. 1514 // afterwards, if all skfyiles in the run have the new state, update the state for the run as well 1515 // shared code for the modes -tocleanedskyfile -tofullskyfile -topurgedskyfile 1516 1517 static bool change_skyfile_data_state(pxConfig *config, psString data_state, psString run_state) 1518 { 1519 PS_ASSERT_PTR_NON_NULL(config, false); 1520 1521 // warp_id, skycell_id are required 1522 PXOPT_LOOKUP_S64(warp_id, config->args, "-warp_id", true, false); 1523 PXOPT_LOOKUP_STR(skycell_id, config->args, "-skycell_id", true, false); 1524 1525 psString query = pxDataGet("warptool_change_skyfile_data_state.sql"); 1526 1527 if (!psDBTransaction(config->dbh)) { 1528 psError(PS_ERR_UNKNOWN, false, "database error"); 1529 return false; 1530 } 1531 1532 // note only updates if warpRun.state = run_state 1533 if (!p_psDBRunQuery(config->dbh, query, data_state, warp_id, skycell_id, run_state)) { 1534 psError(PS_ERR_UNKNOWN, false, "database error"); 1535 // rollback 1536 if (!psDBRollback(config->dbh)) { 1537 psError(PS_ERR_UNKNOWN, false, "database error"); 1538 } 1539 psError(PS_ERR_UNKNOWN, false, "database error"); 1540 return false; 1541 } 1542 psFree(query); 1543 1544 query = pxDataGet("warptool_change_run_state.sql"); 1545 if (!p_psDBRunQuery(config->dbh, query, data_state, warp_id, data_state)) { 1546 // rollback 1547 if (!psDBRollback(config->dbh)) { 1548 psError(PS_ERR_UNKNOWN, false, "database error"); 1549 } 1550 psError(PS_ERR_UNKNOWN, false, "database error"); 1551 return false; 1552 } 1553 1554 if (!psDBCommit(config->dbh)) { 1555 psError(PS_ERR_UNKNOWN, false, "database error"); 1556 return false; 1557 } 1558 1559 return true; 1560 } 1561 static bool tocleanedskyfileMode(pxConfig *config) 1562 { 1563 return change_skyfile_data_state(config, "cleaned", "goto_cleaned"); 1564 } 1565 static bool tofullskyfileMode(pxConfig *config) 1566 { 1567 return change_skyfile_data_state(config, "full", "update"); 1568 } 1569 static bool topurgedskyfileMode(pxConfig *config) 1570 { 1571 return change_skyfile_data_state(config, "purged", "goto_purged"); 1572 } 1573 1574 static bool updateskyfileMode(pxConfig *config) 1575 { 1576 PS_ASSERT_PTR_NON_NULL(config, false); 1577 1578 // warp_id, skycell_id, code are required 1579 PXOPT_LOOKUP_S64(warp_id, config->args, "-warp_id", true, false); 1580 PXOPT_LOOKUP_STR(skycell_id, config->args, "-skycell_id", true, false); 1581 PXOPT_LOOKUP_S16(code, config->args, "-code", false, false); 1582 1583 psString query = pxDataGet("warptool_updateskyfile.sql"); 1584 1585 // note only updates if warpRun.state = run_state 1586 if (!p_psDBRunQuery(config->dbh, query, code, warp_id, skycell_id)) { 1587 psError(PS_ERR_UNKNOWN, false, "database error"); 1588 return false; 1589 } 1590 psFree(query); 1591 1592 return true; 1593 }
Note:
See TracChangeset
for help on using the changeset viewer.
