- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ippTools/src (modified) (1 prop)
-
ippTools/src/dettool_detrunsummary.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/ippTools/src
- Property svn:ignore
-
old new 1 *.la 2 *.lo 1 3 .deps 2 4 .gdb_history … … 4 6 Makefile 5 7 Makefile.in 8 addtool 9 caltool 10 camtool 11 chiptool 6 12 config.h 7 13 config.h.in 8 stamp-h1 9 *.la 10 *.lo 14 detselect 15 dettool 16 difftool 17 disttool 18 dqstatstool 19 faketool 20 flatcorr 21 guidetool 22 magicdstool 23 magictool 24 pstamptool 25 pubtool 26 pxadmin 27 pxdata.c 28 pxinject 11 29 pxtoolsErrorCodes.c 12 30 pxtoolsErrorCodes.h 13 pxadmin14 pxinject15 pztool16 31 pzgetexp 17 32 pzgetimfiles 33 pztool 34 receivetool 18 35 regtool 19 guidetool 20 chiptool 21 camtool 36 stacktool 37 stamp-h1 22 38 warptool 23 difftool24 stacktool25 faketool26 dettool27 detselect28 pxdata.c29 magictool30 magicdstool31 caltool32 flatcorr33 pstamptool34 disttool35 receivetool36 37 pubtool
-
- Property svn:ignore
-
branches/simtest_nebulous_branches/ippTools/src/dettool_detrunsummary.c
r23688 r27840 35 35 psString query = pxDataGet("dettool_todetrunsummary.sql"); 36 36 if (!query) { 37 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");37 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 38 38 return false; 39 39 } … … 135 135 psString query = pxDataGet("dettool_find_completed_runs.sql"); 136 136 if (!query) { 137 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");137 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 138 138 return false; 139 139 } … … 241 241 psString query = pxDataGet("dettool_detrunsummary.sql"); 242 242 if (!query) { 243 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");243 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 244 244 psFree(where); 245 245 return false; … … 310 310 psString query = pxDataGet("dettool_revertdetrunsummary.sql"); 311 311 if (!query) { 312 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");312 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 313 313 return false; 314 314 } … … 336 336 } 337 337 338 // XXX need to add -data_state here 338 bool pendingcleanup_detrunsummaryMode(pxConfig *config) { 339 PS_ASSERT_PTR_NON_NULL(config, false); 340 341 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 342 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 343 344 psMetadata *where = psMetadataAlloc(); 345 PXOPT_COPY_S64(config->args, where, "-det_id", "det_id", "=="); 346 PXOPT_COPY_S32(config->args, where, "-iteration", "iteration", "=="); 347 348 psString query = pxDataGet("dettool_pendingcleanup_detrunsummary.sql"); 349 if (!query) { 350 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 351 return(false); 352 } 353 354 if (psListLength(where->list)) { 355 psString whereClause = psDBGenerateWhereConditionSQL(where, "detRunSummary"); 356 psStringAppend(&query, " AND %s", whereClause); 357 psFree(whereClause); 358 } 359 psFree(where); 360 361 // treat limit == 0 as "no limit" 362 if (limit) { 363 psString limitString = psDBGenerateLimitSQL(limit); 364 psStringAppend(&query, " %s", limitString); 365 psFree(limitString); 366 } 367 // fprintf(stderr,">>>%s<<<\n",query); 368 if (!p_psDBRunQuery(config->dbh, query)) { 369 psError(PS_ERR_UNKNOWN, false, "database error"); 370 psFree(query); 371 return(false); 372 } 373 psFree(query); 374 375 psArray *output = p_psDBFetchResult(config->dbh); 376 if (!output) { 377 psError(PS_ERR_UNKNOWN, false, "database error"); 378 return(false); 379 } 380 if (!psArrayLength(output)) { 381 psTrace("dettool", PS_LOG_INFO, "no rows found"); 382 psFree(output); 383 return(true); 384 } 385 386 // negative simple so the default is true 387 if (!ippdbPrintMetadatas(stdout, output, "pendingCleanupDetRun", !simple)) { 388 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 389 psFree(output); 390 return(false); 391 } 392 psFree(output); 393 394 return(true); 395 } 396 397 398 // preliminary code now. 339 399 bool updatedetrunsummaryMode(pxConfig *config) 340 400 { … … 344 404 PXOPT_LOOKUP_BOOL(accept, config->args, "-accept", false); 345 405 PXOPT_LOOKUP_BOOL(reject, config->args, "-reject", false); 406 PXOPT_LOOKUP_STR(data_state, config->args, "-data_state", ((accept == 0)&&(reject == 0)), false); 407 PXOPT_LOOKUP_S32(iteration, config->args, "-iteration", ((accept == 0)&&(reject == 0)), false); 408 346 409 347 410 if (accept && reject) { … … 350 413 } 351 414 352 if (!(accept || reject)) { 353 psError(PS_ERR_UNKNOWN, true, "either -accept or -reject is required"); 354 return false; 355 } 356 357 char *query = "UPDATE detRunSummary SET accept = %d WHERE det_id = %"PRId64; 358 if (!p_psDBRunQueryF(config->dbh, query, accept, det_id)) { 359 psError(PS_ERR_UNKNOWN, false, "database error"); 360 return false; 415 if (!(accept || reject || (data_state != NULL))) { 416 psError(PS_ERR_UNKNOWN, true, "either -accept or -reject is required if -data_state is not supplied"); 417 return false; 418 } 419 420 if (accept || reject) { 421 char *query = "UPDATE detRunSummary SET accept = %d WHERE det_id = %"PRId64; 422 if (!p_psDBRunQueryF(config->dbh, query, accept, det_id)) { 423 psError(PS_ERR_UNKNOWN, false, "database error"); 424 return false; 425 } 426 } 427 else { 428 PS_ASSERT_PTR_NON_NULL(data_state,false); 429 430 /* if (!isValidDataState(data_state)) return false; */ 431 432 433 434 char *query_detRunSummary = "UPDATE detRunSummary SET data_state = '%s'" 435 " WHERE det_id = %" PRId64 436 " AND iteration = %" PRId32; 437 if (!p_psDBRunQueryF(config->dbh, query_detRunSummary, data_state, det_id,iteration)) { 438 psError(PS_ERR_UNKNOWN, false, 439 "failed to change state for det_id %" PRId64 ", iteration %" PRId32, det_id,iteration); 440 return false; 441 } 442 443 /* This check allows the one update to flag everything for cleanup. The check for full is only temporary while I test for bugs. */ 444 if ((!strncmp(data_state,"goto_",5) 445 // || (!strcmp(data_state,"full")) 446 // || (!strcmp(data_state,"cleaned")) 447 )) { 448 char *query_detProcessedImfile = "UPDATE detProcessedImfile SET data_state = '%s'" 449 " WHERE det_id = %" PRId64; 450 if (!p_psDBRunQueryF(config->dbh, query_detProcessedImfile,data_state,det_id)) { 451 psError(PS_ERR_UNKNOWN, false, 452 "failed to change state for detProcessedImfile det_id %" PRId64 ", iteration %" PRId32, det_id,iteration); 453 return(false); 454 } 455 456 char *query_detProcessedExp = "UPDATE detProcessedExp SET data_state = '%s'" 457 " WHERE det_id = %" PRId64; 458 if (!p_psDBRunQueryF(config->dbh, query_detProcessedExp,data_state,det_id)) { 459 psError(PS_ERR_UNKNOWN, false, 460 "failed to change state for detProcessedExp det_id %" PRId64 ", iteration %" PRId32, det_id,iteration); 461 return(false); 462 } 463 464 char *query_detNormalizedImfile = "UPDATE detNormalizedImfile SET data_state = '%s'" 465 " WHERE det_id = %" PRId64 466 " AND iteration = %" PRId32; 467 if (!p_psDBRunQueryF(config->dbh, query_detNormalizedImfile,data_state,det_id,iteration)) { 468 psError(PS_ERR_UNKNOWN, false, 469 "failed to change state for detNormalizedImfile det_id %" PRId64 ", iteration %" PRId32, det_id,iteration); 470 return(false); 471 } 472 473 char *query_detNormalizedStatImfile = "UPDATE detNormalizedStatImfile SET data_state = '%s'" 474 " WHERE det_id = %" PRId64 475 " AND iteration = %" PRId32; 476 if (!p_psDBRunQueryF(config->dbh, query_detNormalizedStatImfile,data_state,det_id,iteration)) { 477 psError(PS_ERR_UNKNOWN, false, 478 "failed to change state for detNormalizedStatImfile det_id %" PRId64 ", iteration %" PRId32, det_id,iteration); 479 return(false); 480 } 481 482 char *query_detNormalizedExp = "UPDATE detNormalizedExp SET data_state = '%s'" 483 " WHERE det_id = %" PRId64 484 " AND iteration = %" PRId32; 485 if (!p_psDBRunQueryF(config->dbh, query_detNormalizedExp,data_state,det_id,iteration)) { 486 psError(PS_ERR_UNKNOWN, false, 487 "failed to change state for detNormalizedExp det_id %" PRId64 ", iteration %" PRId32, det_id,iteration); 488 return(false); 489 } 490 491 char *query_detResidImfile = "UPDATE detResidImfile SET data_state = '%s'" 492 " WHERE det_id = %" PRId64 493 " AND iteration = %" PRId32; 494 if (!p_psDBRunQueryF(config->dbh, query_detResidImfile,data_state,det_id,iteration)) { 495 psError(PS_ERR_UNKNOWN, false, 496 "failed to change state for detResidImfile det_id %" PRId64 ", iteration %" PRId32, det_id,iteration); 497 return(false); 498 } 499 500 char *query_detResidExp = "UPDATE detResidExp SET data_state = '%s'" 501 " WHERE det_id = %" PRId64 502 " AND iteration = %" PRId32; 503 if (!p_psDBRunQueryF(config->dbh, query_detResidExp,data_state,det_id,iteration)) { 504 psError(PS_ERR_UNKNOWN, false, 505 "failed to change state for detResidExp det_id %" PRId64 ", iteration %" PRId32, det_id,iteration); 506 return(false); 507 } 508 509 char *query_detStackedImfile = "UPDATE detStackedImfile SET data_state = '%s'" 510 " WHERE det_id = %" PRId64 511 " AND iteration = %" PRId32; 512 if (!p_psDBRunQueryF(config->dbh, query_detStackedImfile,data_state,det_id,iteration)) { 513 psError(PS_ERR_UNKNOWN, false, 514 "failed to change state for detStackedImfile det_id %" PRId64 ", iteration %" PRId32, det_id,iteration); 515 return(false); 516 } 517 } 518 /* End if */ 519 361 520 } 362 521
Note:
See TracChangeset
for help on using the changeset viewer.
