Changeset 17145 for trunk/ippTools/src/warptool.c
- Timestamp:
- Mar 25, 2008, 1:23:41 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/warptool.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/warptool.c
r17142 r17145 43 43 static bool warpedMode(pxConfig *config); 44 44 static bool revertwarpedMode(pxConfig *config); 45 static bool blockMode(pxConfig *config); 46 static bool maskedMode(pxConfig *config); 47 static bool unblockMode(pxConfig *config); 45 48 46 49 static bool parseAndInsertSkyCellMap(pxConfig *config, const char *mapfile); … … 77 80 MODECASE(WARPTOOL_MODE_WARPED, warpedMode); 78 81 MODECASE(WARPTOOL_MODE_REVERTWARPED, revertwarpedMode); 82 MODECASE(WARPTOOL_MODE_BLOCK, blockMode); 83 MODECASE(WARPTOOL_MODE_MASKED, maskedMode); 84 MODECASE(WARPTOOL_MODE_UNBLOCK, unblockMode); 85 79 86 default: 80 87 psAbort("invalid option (this should not happen)"); … … 926 933 927 934 935 static bool blockMode(pxConfig *config) 936 { 937 PS_ASSERT_PTR_NON_NULL(config, false); 938 939 PXOPT_LOOKUP_STR(label, config->args, "-label", true, false); 940 941 if (!warpMaskInsert(config->dbh, label)) { 942 psError(PS_ERR_UNKNOWN, false, "database error"); 943 return false; 944 } 945 946 return true; 947 } 948 949 950 static bool maskedMode(pxConfig *config) 951 { 952 PS_ASSERT_PTR_NON_NULL(config, false); 953 954 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 955 956 psString query = psStringCopy("SELECT * FROM warpMask"); 957 958 if (!p_psDBRunQuery(config->dbh, query)) { 959 psError(PS_ERR_UNKNOWN, false, "database error"); 960 psFree(query); 961 return false; 962 } 963 psFree(query); 964 965 psArray *output = p_psDBFetchResult(config->dbh); 966 if (!output) { 967 psError(PS_ERR_UNKNOWN, false, "database error"); 968 return false; 969 } 970 if (!psArrayLength(output)) { 971 psTrace("warpool", PS_LOG_INFO, "no rows found"); 972 psFree(output); 973 return true; 974 } 975 976 if (!convertIdToStr(output)) { 977 psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings"); 978 psFree(output); 979 return false; 980 } 981 982 // negative simple so the default is true 983 if (!ippdbPrintMetadatas(stdout, output, "warpMask", !simple)) { 984 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 985 psFree(output); 986 return false; 987 } 988 989 psFree(output); 990 991 return true; 992 } 993 994 995 static bool unblockMode(pxConfig *config) 996 { 997 PS_ASSERT_PTR_NON_NULL(config, false); 998 999 PXOPT_LOOKUP_STR(label, config->args, "-label", true, false); 1000 1001 char *query = "DELETE FROM warpMask WHERE label = '%s'"; 1002 1003 if (!p_psDBRunQuery(config->dbh, query, label)) { 1004 psError(PS_ERR_UNKNOWN, false, "database error"); 1005 return false; 1006 } 1007 1008 return true; 1009 } 1010 1011 928 1012 static bool isValidMode(pxConfig *config, const char *mode) 929 1013 {
Note:
See TracChangeset
for help on using the changeset viewer.
