Changeset 25324 for trunk/ippTools/src/dettool_detrunsummary.c
- Timestamp:
- Sep 10, 2009, 12:52:50 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ippTools/src (modified) (1 prop)
-
ippTools/src/dettool_detrunsummary.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/czw_branch/cleanup merged: 24713,24743,24785,24835,24902,24913,24951-24952,24972
- Property svn:mergeinfo changed
-
trunk/ippTools/src
- Property svn:ignore
-
old new 34 34 disttool 35 35 receivetool 36 36 addtool 37 37 pubtool
-
- Property svn:ignore
-
trunk/ippTools/src/dettool_detrunsummary.c
r23688 r25324 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_DATA, 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.
