Changeset 9119 for trunk/ippTools/src/dettool.c
- Timestamp:
- Oct 2, 2006, 4:26:46 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/dettool.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/dettool.c
r9117 r9119 2582 2582 { 2583 2583 PS_ASSERT_PTR_NON_NULL(config, false); 2584 2585 // select detProcessedImfile.det_id 2586 // select detRun.iteration 2587 // select detRun.det_type 2588 // select detProcessedImfile.exp_tag 2589 // by: 2590 // find the current iteration bassed on det_id 2591 // find all exp_tags in the current det_id/iteration from detInputExp 2592 // find all rawImfiles in the current exp_tags 2593 // compare to detProcessedImfiles by det_id/exp_tag 2594 // found how many imfile there are in each class_id 2595 // and: 2596 // det_id is not in detProcessedExp; 2597 // iteration is not in detProcessedExp; 2598 2599 psString query = psStringCopy( 2600 " SELECT DISTINCT" 2601 " detRun.position as det_id," 2602 " detRun.iteration," 2603 " detRun.det_type," 2604 " rawDetrendExp.camera," 2605 " rawDetrendExp.telescope," 2606 " rawDetrendExp.exp_type," 2607 " rawDetrendExp.imfiles" 2608 " FROM detRun" 2609 " JOIN detInputExp" 2610 " ON detRun.position = detInputExp.det_id" 2611 " AND detRun.iteration = detInputExp.iteration" 2612 " JOIN rawDetrendExp" 2613 " ON detInputExp.exp_tag = rawDetrendExp.exp_tag" 2614 " JOIN detNormalizedImfile" 2615 " ON detInputExp.det_id = detNormalizedImfile.det_id" 2616 " AND detInputExp.iteration = detNormalizedImfile.iteration" 2617 " LEFT JOIN rawImfile" 2618 " ON detInputExp.exp_tag = rawImfile.exp_tag" 2619 " AND detNormalizedImfile.class_id = rawImfile.class_id" 2620 " LEFT JOIN detNormalizedExp" 2621 " ON detInputExp.det_id = detNormalizedExp.det_id" 2622 " AND detInputExp.iteration = detNormalizedExp.iteration" 2623 " WHERE" 2624 " detNormalizedExp.det_id IS NULL" 2625 " AND detNormalizedExp.iteration IS NULL" 2626 " AND detInputExp.include = 1" 2627 " GROUP BY" 2628 " detNormalizedImfile.iteration," 2629 " detRun.position" 2630 " HAVING" 2631 " COUNT(detNormalizedImfile.class_id) = COUNT(rawImfile.class_id)" 2632 ); 2633 2634 // XXX does it make sens to accept any search params? 2635 #if 0 2636 if (config->where) { 2637 psString whereClause = psDBGenerateWhereConditionSQL(config->where); 2638 psStringAppend(&query, " AND %s", whereClause); 2639 psFree(whereClause); 2640 } 2641 #endif 2642 2643 if (!p_psDBRunQuery(config->dbh, query)) { 2644 psError(PS_ERR_UNKNOWN, false, "database error"); 2645 psFree(query); 2646 return false; 2647 } 2648 psFree(query); 2649 2650 psArray *output = p_psDBFetchResult(config->dbh); 2651 if (!output) { 2652 psError(PS_ERR_UNKNOWN, false, "database error"); 2653 psFree(query); 2654 } 2655 if (!psArrayLength(output)) { 2656 // XXX check psError here 2657 psError(PS_ERR_UNKNOWN, false, "no rawImfile rows found"); 2658 psFree(output); 2659 return true; 2660 } 2661 2662 bool simple = false; 2663 { 2664 bool status = false; 2665 simple = psMetadataLookupBool(&status, config->args, "-simple"); 2666 if (!status) { 2667 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 2668 return false; 2669 } 2670 } 2671 2672 // negative simple so the default is true 2673 if (!ippdbPrintMetadatas(stdout, output, "detProcessedImfile", !simple)) { 2674 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 2675 psFree(output); 2676 return false; 2677 } 2678 2679 psFree(output); 2680 2584 2681 2585 2682 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
