Changeset 28154 for trunk/ippTools/src
- Timestamp:
- May 28, 2010, 8:26:37 AM (16 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
staticskytool.c (modified) (9 diffs)
-
staticskytoolConfig.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src
- Property svn:ignore
-
old new 38 38 stamp-h1 39 39 warptool 40 40 staticskytool
-
- Property svn:ignore
-
trunk/ippTools/src/staticskytool.c
r28096 r28154 42 42 static bool importrunMode(pxConfig *config); 43 43 44 static bool setstaticskyRunState(pxConfig *config, psS64 sky_id, const char *state); 45 44 46 # define MODECASE(caseName, func) \ 45 47 case caseName: \ … … 129 131 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 130 132 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false); 133 PXOPT_LOOKUP_BOOL(check_inputs, config->args, "-check_inputs", false); 131 134 132 135 psString select = pxDataGet("staticskytool_definebyquery_select.sql"); … … 255 258 psWarning("staticskytool ERROR: no rows found for known tess_id, skycell_id?"); 256 259 continue; 260 } 261 262 if (check_inputs) { 263 // negative simple so the default is true 264 if (!ippdbPrintMetadatas(stdout, inputs, "staticskyInput", !simple)) { 265 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 266 psFree(output); 267 psFree(where); 268 return false; 269 } 270 psFree(inputs); 271 continue; 257 272 } 258 273 … … 550 565 } 551 566 567 if (!fault) { 568 if (!setstaticskyRunState(config, sky_id, "full")) { 569 if (!psDBRollback(config->dbh)) { 570 psError(PS_ERR_UNKNOWN, false, "database error"); 571 } 572 psError(PS_ERR_UNKNOWN, false, "failed to change staticskyRun state"); 573 return false; 574 } 575 } 576 552 577 // point of no return 553 578 if (!psDBCommit(config->dbh)) { … … 643 668 PS_ASSERT_PTR_NON_NULL(config, false); 644 669 645 # if (0)646 670 psMetadata *where = psMetadataAlloc(); 647 PXOPT_COPY_S64(config->args, where, "-s tack_id", "stackSumSkyfile.stack_id", "==");648 pxAddLabelSearchArgs(config, where, "-label", "sta ckRun.label", "==");649 PXOPT_COPY_S16(config->args, where, "-fault", "sta ckSumSkyfile.fault", "==");671 PXOPT_COPY_S64(config->args, where, "-sky_id", "staticskyResult.sky_id", "=="); 672 pxAddLabelSearchArgs(config, where, "-label", "staticskyRun.label", "=="); 673 PXOPT_COPY_S16(config->args, where, "-fault", "staticskyResult.fault", "=="); 650 674 651 675 if (!psListLength(where->list) && !psMetadataLookupBool(NULL, config->args, "-all")) { … … 656 680 657 681 // Delete product 658 psString delete = pxDataGet("staticskytool_revert sumskyfile_delete.sql");682 psString delete = pxDataGet("staticskytool_revert.sql"); 659 683 if (!delete) { 660 684 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); … … 680 704 681 705 psFree(where); 682 # endif683 684 706 return true; 685 707 } 686 708 687 # if (0)688 static bool updateresultState(pxConfig *config)689 {690 // check that state is a valid string value691 if (!pxIsValidState(state)) {692 psError(PS_ERR_UNKNOWN, false, "invalid stackRun state: %s", state);693 return false;694 }695 696 char *query = "UPDATE stackRun SET state = '%s' WHERE stack_id = %"PRId64;697 if (!p_psDBRunQueryF(config->dbh, query, state, stack_id)) {698 psError(PS_ERR_UNKNOWN, false,699 "failed to change state for stack_id %"PRId64, stack_id);700 return false;701 }702 return true;703 }704 # endif705 706 709 static bool updateresult(pxConfig *config) 707 710 { 708 711 PS_ASSERT_PTR_NON_NULL(config, false); 709 712 710 # if (0)711 713 PXOPT_LOOKUP_S16(fault, config->args, "-fault", true, false); 712 714 713 715 psMetadata *where = psMetadataAlloc(); 714 PXOPT_COPY_S64(config->args, where, "-s tack_id", "stack_id", "==");715 716 if (!pxSetFaultCode(config->dbh, "sta ckSumSkyfile", where, fault)) {716 PXOPT_COPY_S64(config->args, where, "-sky_id", "sky_id", "=="); 717 718 if (!pxSetFaultCode(config->dbh, "staticskyResult", where, fault)) { 717 719 psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag"); 718 720 psFree (where); … … 720 722 } 721 723 psFree (where); 722 723 # endif724 724 return true; 725 725 } … … 898 898 # endif 899 899 return true; 900 } 901 902 static bool setstaticskyRunState(pxConfig *config, psS64 sky_id, const char *state) 903 { 904 PS_ASSERT_PTR_NON_NULL(state, false); 905 906 // check that state is a valid string value 907 if (!pxIsValidState(state)) { 908 psError(PS_ERR_UNKNOWN, false, "invalid staticskyRun state: %s", state); 909 return false; 910 } 911 912 char *query = "UPDATE staticskyRun SET state = '%s' WHERE sky_id = %"PRId64; 913 if (!p_psDBRunQueryF(config->dbh, query, state, sky_id)) { 914 psError(PS_ERR_UNKNOWN, false, "failed to change state for sky_id %"PRId64, sky_id); 915 return false; 916 } 917 return true; 918 900 919 } 901 920 -
trunk/ippTools/src/staticskytoolConfig.c
r28096 r28154 61 61 psMetadataAddTime(definebyqueryArgs, PS_LIST_TAIL, "-set_registered", 0, "time detrend run was registered", now); 62 62 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-pretend", 0, "do not actually modify the database", false); 63 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-check_inputs", 0, "list inputs, do not modify database", false); 63 64 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 64 65
Note:
See TracChangeset
for help on using the changeset viewer.
