Changeset 14059 for trunk/ippTools/src/dettool.c
- Timestamp:
- Jul 6, 2007, 4:50:21 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/dettool.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/dettool.c
r14047 r14059 3228 3228 } 3229 3229 3230 // select detRun.det_id (det_id) 3231 // select detRun.iteration 3232 // by: 3233 // find the current iteration bassed on det_id 3234 // find all exp_ids in the current det_id/iteration from detInputExp 3235 // sort to detInputExp.imfiles to find the largest value per det_id/iter 3236 // compare imfiles to the number of detStackedImfiles by class_id 3237 // and: 3238 // ??? 3239 // det_id is not in detStackedImfile; 3240 // iteration is not in detStackedImfile; 3241 // class_id is not in detStackedImfile; 3242 3243 psString query = psStringCopy( 3244 "SELECT" 3245 " det_id," 3246 " det_type," 3247 " iteration," 3248 " camera," 3249 " workdir" 3250 " FROM" 3251 "(SELECT DISTINCT" 3252 " detRun.det_id," 3253 " detRun.det_type," 3254 " detRun.iteration," 3255 " detRun.workdir," 3256 " rawExp.camera," 3257 " rawExp.imfiles," 3258 " detStackedImfile.class_id" 3259 " FROM detRun" 3260 " JOIN detInputExp" 3261 " ON detRun.det_id = detInputExp.det_id" 3262 " AND detRun.iteration = detInputExp.iteration" 3263 " JOIN rawExp" 3264 " ON detInputExp.exp_id = rawExp.exp_id" 3265 " JOIN detStackedImfile" 3266 " ON detInputExp.det_id = detStackedImfile.det_id" 3267 " AND detInputExp.iteration = detStackedImfile.iteration" 3268 " LEFT JOIN detNormalizedStatImfile" 3269 " ON detStackedImfile.det_id = detNormalizedStatImfile.det_id" 3270 " AND detStackedImfile.iteration = detNormalizedStatImfile.iteration" 3271 " AND detStackedImfile.class_id = detNormalizedStatImfile.class_id" 3272 " WHERE" 3273 " detRun.state = 'run'" 3274 " AND detRun.mode = 'master'" 3275 " AND detStackedImfile.fault = 0" 3276 " AND detNormalizedStatImfile.det_id IS NULL" 3277 " AND detNormalizedStatImfile.iteration IS NULL" 3278 " AND detNormalizedStatImfile.class_id IS NULL" 3279 " GROUP BY" 3280 " rawExp.exp_id," 3281 " detRun.iteration," 3282 " detRun.det_id" 3283 " HAVING MAX(rawExp.imfiles) = COUNT(detStackedImfile.class_id)" 3284 ") as tonormalizedstat" 3285 ); 3230 psString query = pxDataGet("dettool_tonormalizedstat.sql"); 3231 if (!query) { 3232 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 3233 return false; 3234 } 3286 3235 3287 3236 // XXX does it make sense to accept any search params? … … 3803 3752 } 3804 3753 3805 psString query = psStringCopy( 3806 " SELECT DISTINCT" 3807 " detRun.det_id as det_id," 3808 " detRun.iteration," 3809 " detRun.det_type," 3810 " detRun.workdir," 3811 " rawExp.camera," 3812 " rawExp.telescope," 3813 " rawExp.exp_type," 3814 " rawExp.imfiles" 3815 " FROM detRun" 3816 " JOIN detInputExp" 3817 " ON detRun.det_id = detInputExp.det_id" 3818 " AND detRun.iteration = detInputExp.iteration" 3819 " JOIN rawExp" 3820 " ON detInputExp.exp_id = rawExp.exp_id" 3821 " JOIN detNormalizedImfile" 3822 " ON detInputExp.det_id = detNormalizedImfile.det_id" 3823 " AND detInputExp.iteration = detNormalizedImfile.iteration" 3824 " LEFT JOIN rawImfile" 3825 " ON detInputExp.exp_id = rawImfile.exp_id" 3826 " AND detNormalizedImfile.class_id = rawImfile.class_id" 3827 " LEFT JOIN detNormalizedExp" 3828 " ON detInputExp.det_id = detNormalizedExp.det_id" 3829 " AND detInputExp.iteration = detNormalizedExp.iteration" 3830 " WHERE" 3831 " detRun.state = 'run'" 3832 " AND detRun.mode = 'master'" 3833 " AND detNormalizedImfile.fault = 0" 3834 " AND detNormalizedExp.det_id IS NULL" 3835 " AND detNormalizedExp.iteration IS NULL" 3836 " AND detInputExp.include = 1" 3837 " GROUP BY" 3838 " detNormalizedImfile.iteration," 3839 " detRun.det_id" 3840 " HAVING" 3841 " COUNT(detNormalizedImfile.class_id) = COUNT(rawImfile.class_id)" 3842 ); 3754 psString query = pxDataGet("dettool_tonormalizedexp.sql"); 3755 if (!query) { 3756 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 3757 return false; 3758 } 3843 3759 3844 3760 // XXX does it make sense to accept any search params? … … 3993 3909 } 3994 3910 3995 psString query = psStringCopy( 3996 " SELECT DISTINCT" 3997 " detRun.det_id as det_id," 3998 " detRun.iteration," 3999 " detRun.det_type," 4000 " rawExp.camera," 4001 " rawExp.telescope," 4002 " rawExp.exp_type," 4003 " rawExp.imfiles" 4004 " FROM detRun" 4005 " JOIN detInputExp" 4006 " ON detRun.det_id = detInputExp.det_id" 4007 " AND detRun.iteration = detInputExp.iteration" 4008 " JOIN rawExp" 4009 " ON detInputExp.exp_id = rawExp.exp_id" 4010 " JOIN detNormalizedImfile" 4011 " ON detInputExp.det_id = detNormalizedImfile.det_id" 4012 " AND detInputExp.iteration = detNormalizedImfile.iteration" 4013 " LEFT JOIN rawImfile" 4014 " ON detInputExp.exp_id = rawImfile.exp_id" 4015 " AND detNormalizedImfile.class_id = rawImfile.class_id" 4016 " LEFT JOIN detNormalizedExp" 4017 " ON detInputExp.det_id = detNormalizedExp.det_id" 4018 " AND detInputExp.iteration = detNormalizedExp.iteration" 4019 " WHERE" 4020 " detRun.state = 'run'" 4021 " AND detRun.mode = 'master'" 4022 " AND detNormalizedExp.det_id IS NULL" 4023 " AND detNormalizedExp.iteration IS NULL" 4024 " AND detInputExp.include = 1" 4025 " AND detRun.det_id = %s" 4026 " AND detNormalizedImfile.iteration = %d" 4027 " GROUP BY" 4028 " detNormalizedImfile.iteration," 4029 " detRun.det_id" 4030 " HAVING" 4031 " COUNT(detNormalizedImfile.class_id) = COUNT(rawImfile.class_id)" 4032 ); 4033 4034 if (!p_psDBRunQuery(config->dbh, query, det_id, iteration)) { 3911 psString query = pxDataGet("dettool_tonormalizedexp.sql"); 3912 if (!query) { 3913 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 3914 return false; 3915 } 3916 3917 psStringAppend(&query, 3918 "WHERE det_id = %s" 3919 " AND iteration = %d", det_id, iteration); 3920 3921 3922 if (!p_psDBRunQuery(config->dbh, query)) { 4035 3923 psError(PS_ERR_UNKNOWN, false, "database error"); 4036 3924 psFree(query); … … 4993 4881 // detResidImfile.{det_id, iteration, exp_id} is not in detResidExp 4994 4882 4995 psString query = psStringCopy( 4996 "SELECT DISTINCT" 4997 " det_id," 4998 " iteration," 4999 " exp_id," 5000 " include" 5001 " FROM" 5002 " (SELECT DISTINCT" 5003 " detRun.det_id AS det_id," 5004 " detRun.iteration," 5005 " detRun.det_type," 5006 " detInputExp.exp_id," 5007 " detInputExp.include," 5008 " rawExp.imfiles" 5009 " FROM detRun" 5010 " JOIN detInputExp" 5011 " USING(det_id, iteration)" 5012 " JOIN rawExp" 5013 " ON detInputExp.exp_id = rawExp.exp_id" 5014 " JOIN detResidImfile" 5015 " ON detRun.det_id = detResidImfile.det_id" 5016 " AND detRun.iteration = detResidImfile.iteration" 5017 " AND detInputExp.exp_id = detResidImfile.exp_id" 5018 " LEFT JOIN detResidExp" 5019 " ON detResidImfile.det_id = detResidExp.det_id" 5020 " AND detResidImfile.iteration = detResidExp.iteration" 5021 " AND detResidImfile.exp_id = detResidExp.exp_id" 5022 " WHERE" 5023 " detRun.state = 'run'" 5024 " AND detResidExp.det_id IS NULL" 5025 " AND detResidExp.iteration IS NULL" 5026 " AND detResidExp.exp_id IS NULL" 5027 " GROUP BY" 5028 " detInputExp.exp_id," 5029 " detRun.iteration," 5030 " detRun.det_id" 5031 " HAVING" 5032 " rawExp.imfiles = COUNT(detResidImfile.class_id)" 5033 " ) AS toresidexp" 5034 ); 4883 psString query = pxDataGet("dettool_toresidexp.sql"); 4884 if (!query) { 4885 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 4886 return false; 4887 } 5035 4888 5036 4889 {
Note:
See TracChangeset
for help on using the changeset viewer.
