Changeset 17859
- Timestamp:
- May 29, 2008, 4:45:44 PM (18 years ago)
- Location:
- trunk/ippTools
- Files:
-
- 2 added
- 4 edited
-
share/Makefile.am (modified) (2 diffs)
-
share/chiptool_donecleanup.sql (added)
-
share/chiptool_pendingcleanup.sql (added)
-
src/chiptool.c (modified) (3 diffs)
-
src/chiptool.h (modified) (2 diffs)
-
src/chiptoolConfig.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/share/Makefile.am
r17712 r17859 8 8 camtool_revertprocessedexp.sql \ 9 9 chiptool_completely_processed_exp.sql \ 10 chiptool_donecleanup.sql \ 10 11 chiptool_find_rawexp.sql \ 11 12 chiptool_find_unprocessed_imfile.pl \ 13 chiptool_pendingcleanup.sql \ 12 14 chiptool_pendingimfile.sql \ 13 15 chiptool_processedimfile.sql \ … … 60 62 pztool_pendingimfile.sql \ 61 63 pztool_revertcopied.sql \ 64 pxadmin_create_tables.sql \ 65 pxadmin_drop_tables.sql \ 62 66 regtool_pendingexp.sql \ 63 67 regtool_pendingimfile.sql \ -
trunk/ippTools/src/chiptool.c
r17591 r17859 45 45 static bool unmaskedMode(pxConfig *config); 46 46 static bool unblockMode(pxConfig *config); 47 static bool pendingcleanupMode(pxConfig *config); 48 static bool donecleanupMode(pxConfig *config); 47 49 48 50 static bool chipProcessedCompleteExp(pxConfig *config); … … 76 78 MODECASE(CHIPTOOL_MODE_UNMASKED, unmaskedMode); 77 79 MODECASE(CHIPTOOL_MODE_UNBLOCK, unblockMode); 80 MODECASE(CHIPTOOL_MODE_PENDINGCLEANUP, pendingcleanupMode); 81 MODECASE(CHIPTOOL_MODE_DONECLEANUP, donecleanupMode); 78 82 default: 79 83 psAbort("invalid option (this should not happen)"); … … 936 940 937 941 942 static bool pendingcleanupMode(pxConfig *config) 943 { 944 PS_ASSERT_PTR_NON_NULL(config, NULL); 945 946 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 947 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 948 949 psMetadata *where = psMetadataAlloc(); 950 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); 951 952 psString query = pxDataGet("chiptool_pendingcleanup.sql"); 953 if (!query) { 954 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 955 return false; 956 } 957 958 if (where && psListLength(where->list)) { 959 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 960 psStringAppend(&query, " AND %s", whereClause); 961 psFree(whereClause); 962 } 963 psFree(where); 964 965 // treat limit == 0 as "no limit" 966 if (limit) { 967 psString limitString = psDBGenerateLimitSQL(limit); 968 psStringAppend(&query, " %s", limitString); 969 psFree(limitString); 970 } 971 972 if (!p_psDBRunQuery(config->dbh, query)) { 973 psError(PS_ERR_UNKNOWN, false, "database error"); 974 psFree(query); 975 return false; 976 } 977 psFree(query); 978 979 psArray *output = p_psDBFetchResult(config->dbh); 980 if (!output) { 981 psError(PS_ERR_UNKNOWN, false, "database error"); 982 return false; 983 } 984 if (!psArrayLength(output)) { 985 psTrace("chiptool", PS_LOG_INFO, "no rows found"); 986 psFree(output); 987 return true; 988 } 989 990 if (!convertIdToStr(output)) { 991 psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings"); 992 psFree(output); 993 return false; 994 } 995 996 // negative simple so the default is true 997 if (!ippdbPrintMetadatas(stdout, output, "chipPendingCleanup", !simple)) { 998 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 999 psFree(output); 1000 return false; 1001 } 1002 1003 psFree(output); 1004 1005 return true; 1006 } 1007 1008 1009 static bool donecleanupMode(pxConfig *config) 1010 { 1011 PS_ASSERT_PTR_NON_NULL(config, NULL); 1012 1013 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1014 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1015 1016 psMetadata *where = psMetadataAlloc(); 1017 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); 1018 1019 psString query = pxDataGet("chiptool_donecleanup.sql"); 1020 if (!query) { 1021 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 1022 return false; 1023 } 1024 1025 if (where && psListLength(where->list)) { 1026 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1027 psStringAppend(&query, " AND %s", whereClause); 1028 psFree(whereClause); 1029 } 1030 psFree(where); 1031 1032 // treat limit == 0 as "no limit" 1033 if (limit) { 1034 psString limitString = psDBGenerateLimitSQL(limit); 1035 psStringAppend(&query, " %s", limitString); 1036 psFree(limitString); 1037 } 1038 1039 if (!p_psDBRunQuery(config->dbh, query)) { 1040 psError(PS_ERR_UNKNOWN, false, "database error"); 1041 psFree(query); 1042 return false; 1043 } 1044 psFree(query); 1045 1046 psArray *output = p_psDBFetchResult(config->dbh); 1047 if (!output) { 1048 psError(PS_ERR_UNKNOWN, false, "database error"); 1049 return false; 1050 } 1051 if (!psArrayLength(output)) { 1052 psTrace("chiptool", PS_LOG_INFO, "no rows found"); 1053 psFree(output); 1054 return true; 1055 } 1056 1057 if (!convertIdToStr(output)) { 1058 psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings"); 1059 psFree(output); 1060 return false; 1061 } 1062 1063 // negative simple so the default is true 1064 if (!ippdbPrintMetadatas(stdout, output, "chipDoneCleanup", !simple)) { 1065 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1066 psFree(output); 1067 return false; 1068 } 1069 1070 psFree(output); 1071 1072 return true; 1073 } 1074 1075 938 1076 static bool chipProcessedCompleteExp(pxConfig *config) 939 1077 { -
trunk/ippTools/src/chiptool.h
r17148 r17859 2 2 * chiptool.h 3 3 * 4 * Copyright (C) 2006 Joshua Hoblitt4 * Copyright (C) 2006-2008 Joshua Hoblitt 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify it … … 36 36 CHIPTOOL_MODE_UNMASKED, 37 37 CHIPTOOL_MODE_UNBLOCK, 38 CHIPTOOL_MODE_RETRYPROCESSEDIMFILE 38 CHIPTOOL_MODE_RETRYPROCESSEDIMFILE, 39 CHIPTOOL_MODE_PENDINGCLEANUP, 40 CHIPTOOL_MODE_DONECLEANUP, 39 41 } chiptoolMode; 40 42 -
trunk/ippTools/src/chiptoolConfig.c
r17611 r17859 271 271 psMetadataAddStr(unblockArgs, PS_LIST_TAIL, "-label", 0, "name of a label to unmask (required)", NULL); 272 272 273 // -pendingcleanup 274 psMetadata *pendingcleanupArgs = psMetadataAlloc(); 275 psMetadataAddStr(pendingcleanupArgs, PS_LIST_TAIL, "-label", 0, "list blocks for specified label", NULL); 276 psMetadataAddBool(pendingcleanupArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 277 psMetadataAddU64(pendingcleanupArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 278 279 // -doneclenaup 280 psMetadata *donecleanupArgs = psMetadataAlloc(); 281 psMetadataAddStr(donecleanupArgs, PS_LIST_TAIL, "-label", 0, "list blocks for specified label", NULL); 282 psMetadataAddBool(donecleanupArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 283 psMetadataAddU64(donecleanupArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 284 273 285 psMetadata *argSets = psMetadataAlloc(); 274 286 psMetadata *modes = psMetadataAlloc(); 275 287 276 PXOPT_ADD_MODE("-queue", "create runs from raw exposures", CHIPTOOL_MODE_QUEUE, queueArgs); 277 PXOPT_ADD_MODE("-updaterun", "change chip run properties", CHIPTOOL_MODE_UPDATERUN, updaterunArgs); 278 PXOPT_ADD_MODE("-pendingimfile", "show pending imfiles", CHIPTOOL_MODE_PENDINGIMFILE, pendingimfileArgs); 279 PXOPT_ADD_MODE("-addprocessedimfile", "add a processed imfile", CHIPTOOL_MODE_ADDPROCESSEDIMFILE,addprocessedimfileArgs); 280 PXOPT_ADD_MODE("-processedimfile", "show processed imfiles", CHIPTOOL_MODE_PROCESSEDIMFILE, processedimfileArgs); 281 PXOPT_ADD_MODE("-updateprocessedimfile", "change procesed imfile properties", CHIPTOOL_MODE_UPDATEPROCESSEDIMFILE, updateprocessedimfileArgs); 282 PXOPT_ADD_MODE("-revertprocessedimfile", "undo a processed imfile", CHIPTOOL_MODE_REVERTPROCESSEDIMFILE, revertprocessedimfileArgs); 283 PXOPT_ADD_MODE("-block", "set a label block", CHIPTOOL_MODE_BLOCK, blockArgs); 284 PXOPT_ADD_MODE("-masked", "show blocked labels", CHIPTOOL_MODE_MASKED, maskedArgs); 285 PXOPT_ADD_MODE("-unmasked", "", CHIPTOOL_MODE_UNMASKED, unmaskedArgs); 286 PXOPT_ADD_MODE("-unblock", "remove a label block", CHIPTOOL_MODE_UNBLOCK, unblockArgs); 288 PXOPT_ADD_MODE("-queue", "create runs from raw exposures", 289 CHIPTOOL_MODE_QUEUE, queueArgs); 290 PXOPT_ADD_MODE("-updaterun", "change chip run properties", 291 CHIPTOOL_MODE_UPDATERUN, updaterunArgs); 292 PXOPT_ADD_MODE("-pendingimfile", "show pending imfiles", 293 CHIPTOOL_MODE_PENDINGIMFILE, pendingimfileArgs); 294 PXOPT_ADD_MODE("-addprocessedimfile", "add a processed imfile", 295 CHIPTOOL_MODE_ADDPROCESSEDIMFILE, addprocessedimfileArgs); 296 PXOPT_ADD_MODE("-processedimfile", "show processed imfiles", 297 CHIPTOOL_MODE_PROCESSEDIMFILE, processedimfileArgs); 298 PXOPT_ADD_MODE("-updateprocessedimfile","change procesed imfile properties", 299 CHIPTOOL_MODE_UPDATEPROCESSEDIMFILE,updateprocessedimfileArgs); 300 PXOPT_ADD_MODE("-revertprocessedimfile","undo a processed imfile", 301 CHIPTOOL_MODE_REVERTPROCESSEDIMFILE,revertprocessedimfileArgs); 302 PXOPT_ADD_MODE("-block", "set a label block", 303 CHIPTOOL_MODE_BLOCK, blockArgs); 304 PXOPT_ADD_MODE("-masked", "show blocked labels", 305 CHIPTOOL_MODE_MASKED, maskedArgs); 306 PXOPT_ADD_MODE("-unmasked", "", 307 CHIPTOOL_MODE_UNMASKED, unmaskedArgs); 308 PXOPT_ADD_MODE("-unblock", "remove a label block", 309 CHIPTOOL_MODE_UNBLOCK, unblockArgs); 310 PXOPT_ADD_MODE("-pendingcleanup", "show runs that need to be cleaned up", 311 CHIPTOOL_MODE_PENDINGCLEANUP, pendingcleanupArgs); 312 PXOPT_ADD_MODE("-donecleanup", "show runs that have been cleaned", 313 CHIPTOOL_MODE_DONECLEANUP, donecleanupArgs); 287 314 288 315 if (!pxGetOptions(stderr, argc, argv, config, modes, argSets)) {
Note:
See TracChangeset
for help on using the changeset viewer.
