Changeset 23181
- Timestamp:
- Mar 4, 2009, 8:59:47 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/eam_branch_20090303/ippTools/src/warptool.c
r21402 r23181 55 55 static bool updateskyfileMode(pxConfig *config); 56 56 57 static bool change_skyfile_data_state(pxConfig *config, psString data_state, psString run_state); 57 58 static bool parseAndInsertSkyCellMap(pxConfig *config, const char *mapfile); 58 59 static bool isValidMode(pxConfig *config, const char *mode); … … 1604 1605 // shared code for the modes -tocleanedskyfile -tofullskyfile -topurgedskyfile 1605 1606 1607 // XXX EAM : this function was enforcing only certain transitions with the SQL. However, 1608 // this is getting fairly messy now that we have added a few additional target and 1609 // destination states. I'm disabling these restrictions for now; is there are better way 1610 // to enforce the allowed state transitions? 1611 1606 1612 static bool change_skyfile_data_state(pxConfig *config, psString data_state, psString run_state) 1607 1613 { … … 1619 1625 } 1620 1626 1627 // XXX this feature is disabled (run_state is ignored) 1621 1628 // note only updates if warpRun.state = run_state 1622 if (!p_psDBRunQueryF(config->dbh, query, data_state, warp_id, skycell_id, run_state)) { 1629 1630 if (!p_psDBRunQueryF(config->dbh, query, data_state, warp_id, skycell_id)) { 1623 1631 psError(PS_ERR_UNKNOWN, false, "database error"); 1624 1632 // rollback … … 1668 1676 PXOPT_LOOKUP_S64(warp_id, config->args, "-warp_id", true, false); 1669 1677 PXOPT_LOOKUP_STR(skycell_id, config->args, "-skycell_id", true, false); 1678 PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false); 1670 1679 PXOPT_LOOKUP_S16(code, config->args, "-code", false, false); 1671 1680 1672 psString query = pxDataGet("warptool_updateskyfile.sql"); 1673 1674 if (!p_psDBRunQueryF(config->dbh, query, code, warp_id, skycell_id)) { 1675 psError(PS_ERR_UNKNOWN, false, "database error"); 1676 return false; 1677 } 1678 psFree(query); 1679 1680 return true; 1681 } 1681 if (state && code) { 1682 psError(PS_ERR_UNKNOWN, true, "only one of -set_state and -code may be supplied"); 1683 return false; 1684 } 1685 1686 if (state) { 1687 // make sure that the state string is valid 1688 if (!pxIsValidState(state)) { 1689 psError(PXTOOLS_ERR_DATA, false, "%s is not a valid state", state); 1690 return false; 1691 } 1692 if (!change_skyfile_data_state(config, state, "unknown")) { 1693 psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag"); 1694 return false; 1695 } 1696 return true; 1697 } 1698 1699 if (code) { 1700 psString query = pxDataGet("warptool_updateskyfile.sql"); 1701 1702 if (!p_psDBRunQueryF(config->dbh, query, code, warp_id, skycell_id)) { 1703 psError(PS_ERR_UNKNOWN, false, "database error"); 1704 return false; 1705 } 1706 psFree(query); 1707 return true; 1708 } 1709 1710 psError(PS_ERR_UNKNOWN, true, "one of -set_state or -code must be supplied"); 1711 return false; 1712 }
Note:
See TracChangeset
for help on using the changeset viewer.
