Changeset 23873 for trunk/ippTools/src
- Timestamp:
- Apr 15, 2009, 9:33:58 AM (17 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 14 edited
-
camtool.c (modified) (8 diffs)
-
camtoolConfig.c (modified) (1 diff)
-
chiptool.c (modified) (3 diffs)
-
chiptoolConfig.c (modified) (1 diff)
-
difftool.c (modified) (2 diffs)
-
difftoolConfig.c (modified) (1 diff)
-
faketool.c (modified) (2 diffs)
-
faketoolConfig.c (modified) (1 diff)
-
pxtools.c (modified) (1 diff)
-
pxtools.h (modified) (1 diff)
-
stacktool.c (modified) (2 diffs)
-
stacktoolConfig.c (modified) (1 diff)
-
warptool.c (modified) (2 diffs)
-
warptoolConfig.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/camtool.c
r23830 r23873 109 109 psMetadata *where = psMetadataAlloc(); 110 110 pxcamGetSearchArgs (config, where); 111 PXOPT_COPY_STR(config->args, where, "-label", "c hipRun.label", "==");112 PXOPT_COPY_STR(config->args, where, "-reduction", "c hipRun.reduction", "==");111 PXOPT_COPY_STR(config->args, where, "-label", "camRun.label", "=="); 112 PXOPT_COPY_STR(config->args, where, "-reduction", "camRun.reduction", "=="); 113 113 114 114 if (!psListLength(where->list) && … … 196 196 } 197 197 198 // loop over our list of c hipRun rows198 // loop over our list of camRun rows 199 199 for (long i = 0; i < psArrayLength(output); i++) { 200 200 psMetadata *md = output->data[i]; 201 201 202 c hipRunRow *row = chipRunObjectFromMetadata(md);202 camRunRow *row = camRunObjectFromMetadata(md); 203 203 if (!row) { 204 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into c hipRun");204 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into camRun"); 205 205 psFree(output); 206 206 return false; … … 268 268 269 269 if (state) { 270 // set c hipRun.state to state270 // set camRun.state to state 271 271 if (!pxcamRunSetStateByQuery(config, where, state)) { 272 272 psFree(where); … … 276 276 277 277 if (label) { 278 // set c hipRun.label to label278 // set camRun.label to label 279 279 if (!pxcamRunSetLabelByQuery(config, where, label)) { 280 280 psFree(where); … … 362 362 PXOPT_COPY_STR(config->args, where, "-label", "camRun.label", "=="); 363 363 PXOPT_COPY_STR(config->args, where, "-reduction", "camRun.reduction", "=="); 364 PXOPT_COPY_S64(config->args, where, "-chip_id", "c hipRun.chip_id", "==");365 PXOPT_COPY_STR(config->args, where, "-class_id", "c hipProcessedImfile.class_id", "==");364 PXOPT_COPY_S64(config->args, where, "-chip_id", "camRun.chip_id", "=="); 365 PXOPT_COPY_STR(config->args, where, "-class_id", "camProcessedExp.class_id", "=="); 366 366 367 367 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); … … 400 400 401 401 // negate simple so the default is true 402 if (!ippdbPrintMetadatas(stdout, output, "c hipProcessedImfile", !simple)) {402 if (!ippdbPrintMetadatas(stdout, output, "camProcessedExp", !simple)) { 403 403 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 404 404 psFree(output); … … 1145 1145 PXOPT_LOOKUP_STR(outfile, config->args, "-outfile", true, false); 1146 1146 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1147 PXOPT_LOOKUP_BOOL(clean, config->args, "-clean", false); 1147 1148 1148 1149 FILE *f = fopen (outfile, "w"); … … 1193 1194 } 1194 1195 if (!psArrayLength(output)) { 1195 ps Trace("regtool", PS_LOG_INFO, "no rows found");1196 psError(PS_ERR_UNKNOWN, true, "no rows found"); 1196 1197 psFree(output); 1197 return true; 1198 return false; 1199 } 1200 1201 if (clean) { 1202 if (!strcmp(tables[i].tableName, "camRun")) { 1203 if (!pxSetStateCleaned("camRun", "state", output)) { 1204 psFree(output); 1205 psError(PS_ERR_UNKNOWN, false, "pxSetStateClean failed for table %s", tables[i].tableName); 1206 return false; 1207 } 1208 } 1198 1209 } 1199 1210 -
trunk/ippTools/src/camtoolConfig.c
r23688 r23873 242 242 psMetadataAddStr(exportrunArgs, PS_LIST_TAIL, "-outfile", 0, "export to this file (required)", NULL); 243 243 psMetadataAddU64(exportrunArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 244 psMetadataAddBool(exportrunArgs, PS_LIST_TAIL, "-clean", 0, "export tables as cleaned", false); 244 245 245 246 // -importrun -
trunk/ippTools/src/chiptool.c
r23870 r23873 1308 1308 PS_ASSERT_PTR_NON_NULL(config, NULL); 1309 1309 1310 PXOPT_LOOKUP_S64(d et_id, config->args, "-chip_id", true, false);1310 PXOPT_LOOKUP_S64(dummy, config->args, "-chip_id", true, false); 1311 1311 PXOPT_LOOKUP_STR(outfile, config->args, "-outfile", true, false); 1312 1312 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1313 PXOPT_LOOKUP_BOOL(clean, config->args, "-clean", false); 1314 1313 1315 1314 1316 FILE *f = fopen (outfile, "w"); … … 1361 1363 } 1362 1364 if (!psArrayLength(output)) { 1363 psTrace(" regtool", PS_LOG_INFO, "no rows found");1365 psTrace("chiptool", PS_LOG_INFO, "no rows found"); 1364 1366 psFree(output); 1365 return true; 1367 return false; 1368 } 1369 1370 if (clean) { 1371 bool success = true; 1372 if (!strcmp(tables[i].tableName, "chipRun")) { 1373 success = pxSetStateCleaned("chipRun", "state", output); 1374 } else if (!strcmp(tables[i].tableName, "chipProcessedImfile")) { 1375 success = pxSetStateCleaned("chipProcessedImfile", "data_state", output); 1376 } 1377 if (!success) { 1378 psFree(output); 1379 psError(PS_ERR_UNKNOWN, false, "pxSetStateClean failed for table %s", tables[i].tableName); 1380 return false; 1381 } 1366 1382 } 1367 1383 … … 1429 1445 return true; 1430 1446 } 1431 1432 -
trunk/ippTools/src/chiptoolConfig.c
r23688 r23873 253 253 psMetadataAddS64(exportrunArgs, PS_LIST_TAIL, "-chip_id", 0, "export this chip ID (required)", 0); 254 254 psMetadataAddStr(exportrunArgs, PS_LIST_TAIL, "-outfile", 0, "export to this file (required)", NULL); 255 psMetadataAddBool(exportrunArgs, PS_LIST_TAIL, "-clean", 0, "mark tables as cleaned", false); 255 256 psMetadataAddU64(exportrunArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 256 257 -
trunk/ippTools/src/difftool.c
r23740 r23873 1748 1748 PXOPT_LOOKUP_STR(outfile, config->args, "-outfile", true, false); 1749 1749 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1750 PXOPT_LOOKUP_BOOL(clean, config->args, "-clean", false); 1750 1751 1751 1752 FILE *f = fopen (outfile, "w"); … … 1793 1794 psArray *output = p_psDBFetchResult(config->dbh); 1794 1795 if (!output) { 1795 psError(PS_ERR_UNKNOWN, false, "database error");1796 1796 return false; 1797 1797 } 1798 1798 if (!psArrayLength(output)) { 1799 ps Trace("regtool", PS_LOG_INFO, "no rows found");1799 psError(PS_ERR_UNKNOWN, true, "no rows found"); 1800 1800 psFree(output); 1801 return true; 1801 return false; 1802 } 1803 1804 if (clean) { 1805 bool success = true; 1806 if (!strcmp(tables[i].tableName, "diffRun")) { 1807 success = pxSetStateCleaned("diffRun", "state", output); 1808 #ifdef notyet 1809 // diffSkyfile doesn't have dataState yet 1810 } else if (!strcmp(tables[i].tableName, "diffSkyfile")) { 1811 success = pxSetStateCleaned("diffSkyfile", "data_state", output); 1812 #endif 1813 } 1814 if (!success) { 1815 psFree(output); 1816 psError(PS_ERR_UNKNOWN, false, "pxSetStateClean failed for table %s", tables[i].tableName); 1817 return false; 1818 } 1802 1819 } 1803 1820 -
trunk/ippTools/src/difftoolConfig.c
r23740 r23873 215 215 psMetadataAddStr(exportrunArgs, PS_LIST_TAIL, "-outfile", 0, "export to this file (required)", NULL); 216 216 psMetadataAddU64(exportrunArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 217 psMetadataAddBool(exportrunArgs, PS_LIST_TAIL, "-clean", 0, "mark tables as cleaned", false); 217 218 218 219 // -importrun -
trunk/ippTools/src/faketool.c
r23809 r23873 1265 1265 PXOPT_LOOKUP_STR(outfile, config->args, "-outfile", true, false); 1266 1266 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1267 PXOPT_LOOKUP_BOOL(clean, config->args, "-clean", false); 1267 1268 1268 1269 FILE *f = fopen (outfile, "w"); … … 1313 1314 } 1314 1315 if (!psArrayLength(output)) { 1315 ps Trace("regtool", PS_LOG_INFO, "no rows found");1316 psError(PS_ERR_UNKNOWN, true, "no rows found"); 1316 1317 psFree(output); 1317 return true; 1318 return false; 1319 } 1320 1321 if (clean) { 1322 if (!strcmp(tables[i].tableName, "fakeRun")) { 1323 if(!pxSetStateCleaned("fakeRun", "state", output)) { 1324 psFree(output); 1325 psError(PS_ERR_UNKNOWN, false, "pxSetStateClean failed for table %s", tables[i].tableName); 1326 return false; 1327 } 1328 } 1318 1329 } 1319 1330 -
trunk/ippTools/src/faketoolConfig.c
r23688 r23873 306 306 psMetadataAddStr(exportrunArgs, PS_LIST_TAIL, "-outfile", 0, "export to this file (required)", NULL); 307 307 psMetadataAddU64(exportrunArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 308 psMetadataAddBool(exportrunArgs, PS_LIST_TAIL, "-clean", 0, "mark tables as cleaned", false); 308 309 309 310 // -importrun -
trunk/ippTools/src/pxtools.c
r23123 r23873 50 50 // 'scrubbed' is a virtual state equivalent to cleaned, but allows files to be removed 51 51 // even if the config files is missing 52 53 54 // change the value for tableName.columName from 'full' to 'cleaned' if necessary 55 bool pxSetStateCleaned(const psString tableName, const psString columnName, psArray *rows) 56 { 57 for (long i = 0; i < psArrayLength(rows); i++) { 58 psMetadata *row = rows->data[i]; 59 psString state = psMetadataLookupStr(NULL, row, columnName); 60 if (!state) { 61 psError(PS_ERR_PROGRAMMING, false, "%s not found in row %" PRId64 " of table %s", 62 columnName, i, tableName); 63 return false; 64 } 65 if (!strcmp("full", state)) { 66 // change full to cleaned 67 psMetadataAddStr(row, PS_LIST_TAIL, columnName, PS_META_REPLACE, "", "cleaned"); 68 } else if (strcmp("cleaned", state)) { 69 // if state isn't cleaned or full we can't set it to cleaned 70 psError(PS_ERR_PROGRAMMING, true, "%s with state %s may not be exported cleaned", 71 tableName, state); 72 return false; 73 } 74 } 75 return true; 76 } -
trunk/ippTools/src/pxtools.h
r23868 r23873 50 50 51 51 bool pxIsValidState(const char *state); 52 bool pxSetStateCleaned(const psString tableName, const psString columnName, psArray *rows); 52 53 53 54 bool pxSetFaultCode(psDB *dbh, const char *tableName, psMetadata *where, psS16 code); -
trunk/ippTools/src/stacktool.c
r23742 r23873 1199 1199 PXOPT_LOOKUP_S64(det_id, config->args, "-stack_id", true, false); 1200 1200 PXOPT_LOOKUP_STR(outfile, config->args, "-outfile", true, false); 1201 PXOPT_LOOKUP_BOOL(clean, config->args, "-clean", false); 1201 1202 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1202 1203 … … 1249 1250 } 1250 1251 if (!psArrayLength(output)) { 1251 ps Trace("regtool", PS_LOG_INFO, "no rows found");1252 psError(PS_ERR_UNKNOWN, true, "no rows found"); 1252 1253 psFree(output); 1253 return true; 1254 } 1254 return false; 1255 } 1256 1257 if (clean) { 1258 if (!strcmp(tables[i].tableName, "stackRun")) { 1259 if (!pxSetStateCleaned("stackRun", "state", output)) { 1260 psFree(output); 1261 psError(PS_ERR_UNKNOWN, false, "pxSetStateClean failed for table %s", tables[i].tableName); 1262 return false; 1263 } 1264 } 1265 } 1266 1255 1267 // we must write the export table in non-simple (true) format 1256 1268 if (!ippdbPrintMetadatas(f, output, tables[i].tableName, true)) { -
trunk/ippTools/src/stacktoolConfig.c
r23688 r23873 193 193 psMetadataAddStr(exportrunArgs, PS_LIST_TAIL, "-outfile", 0, "export to this file (required)", NULL); 194 194 psMetadataAddU64(exportrunArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 195 psMetadataAddBool(exportrunArgs, PS_LIST_TAIL, "-clean", 0, "mark tables as cleaned", false); 195 196 196 197 // -importrun -
trunk/ippTools/src/warptool.c
r23809 r23873 1606 1606 PS_ASSERT_PTR_NON_NULL(config, NULL); 1607 1607 1608 PXOPT_LOOKUP_S64(det_id, config->args, "-warp_id", true, false);1608 PXOPT_LOOKUP_S64(det_id, config->args, "-warp_id", true, false); 1609 1609 PXOPT_LOOKUP_STR(outfile, config->args, "-outfile", true, false); 1610 1610 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1611 PXOPT_LOOKUP_BOOL(clean, config->args, "-clean", false); 1611 1612 1612 1613 FILE *f = fopen (outfile, "w"); … … 1661 1662 } 1662 1663 if (!psArrayLength(output)) { 1663 ps Trace("regtool", PS_LOG_INFO, "no rows found");1664 psError(PS_ERR_UNKNOWN, true, "no rows found"); 1664 1665 psFree(output); 1665 return true;1666 return false; 1666 1667 } 1668 1669 if (clean) { 1670 bool success = true; 1671 if (!strcmp(tables[i].tableName, "warpRun")) { 1672 success = pxSetStateCleaned("warpRun", "state", output); 1673 } else if (!strcmp(tables[i].tableName, "warpSkyfile")) { 1674 success = pxSetStateCleaned("warpSkyfile", "data_state", output); 1675 } 1676 if (!success) { 1677 psFree(output); 1678 psError(PS_ERR_UNKNOWN, false, "pxSetStateClean failed for table %s", tables[i].tableName); 1679 return false; 1680 } 1681 } 1667 1682 1668 1683 // we must write the export table in non-simple (true) format -
trunk/ippTools/src/warptoolConfig.c
r23688 r23873 276 276 psMetadataAddStr(exportrunArgs, PS_LIST_TAIL, "-outfile", 0, "export to this file (required)", NULL); 277 277 psMetadataAddU64(exportrunArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 278 psMetadataAddBool(exportrunArgs, PS_LIST_TAIL, "-clean", 0, "export run in cleaned state", false); 278 279 279 280 // -importrun
Note:
See TracChangeset
for help on using the changeset viewer.
