Changeset 19618
- Timestamp:
- Sep 19, 2008, 12:39:17 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080918/ippTools/src/dettool_processedimfile.c
r19092 r19618 165 165 PS_ASSERT_PTR_NON_NULL(config, false); 166 166 167 char *value = NULL;167 bool hasWhere = false; 168 168 169 169 PXOPT_LOOKUP_BOOL(included, config->args, "-included", false); … … 173 173 174 174 psMetadata *where = psMetadataAlloc(); 175 PXOPT_COPY_S64(config->args, where, "-det_id", "det_id", "=="); 176 PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "=="); 177 PXOPT_COPY_STR(config->args, where, "-class_id", "class_id", "=="); 175 PXOPT_COPY_S64(config->args, where, "-det_id", "detProcessedImfile.det_id", "=="); 176 PXOPT_COPY_S64(config->args, where, "-exp_id", "detProcessedImfile.exp_id", "=="); 177 PXOPT_COPY_STR(config->args, where, "-class_id", "detProcessedImfile.class_id", "=="); 178 PXOPT_COPY_STR(config->args, where, "-select_state", "detRun.state", "=="); 179 PXOPT_COPY_STR(config->args, where, "-select_mode", "detRun.mode", "=="); 178 180 179 181 psString query = pxDataGet("dettool_processedimfile.sql"); … … 184 186 } 185 187 186 // add the two required restrictions: detRun.state and detRun.mode187 // NOTE the above query requires one of the following two WHERE statements188 {189 bool status;190 if ((value = psMetadataLookupStr(&status, config->args, "-select_state"))) {191 psStringAppend(&query, " WHERE detRun.state = '%s'", value);192 } else {193 psStringAppend(&query, " WHERE detRun.state = 'run'");194 }195 if ((value = psMetadataLookupStr(&status, config->args, "-select_mode"))) {196 psStringAppend(&query, " AND detRun.mode = '%s'", value);197 } else {198 psStringAppend(&query, " AND detRun.mode = 'master'");199 }200 }201 202 188 if (psListLength(where->list)) { 203 psString whereClause = psDBGenerateWhere ConditionSQL(where, "detProcessedImfile");204 psStringAppend(&query, " AND%s", whereClause);189 psString whereClause = psDBGenerateWhereSQL(where, NULL); 190 psStringAppend(&query, " %s", whereClause); 205 191 psFree(whereClause); 192 hasWhere = true; 206 193 } 207 194 psFree (where); … … 209 196 // restrict search to included imfiles 210 197 if (included) { 211 psStringAppend(&query, " AND detInputExp.include = 1"); 198 if (hasWhere) { 199 psStringAppend(&query, " AND detInputExp.include = 1"); 200 } else { 201 psStringAppend(&query, " WHERE detInputExp.include = 1"); 202 } 203 hasWhere = true; 204 } 205 206 if (hasWhere) { 207 psStringAppend(&query, " AND"); 208 } else { 209 psStringAppend(&query, " WHERE"); 212 210 } 213 211 214 212 if (faulted) { 215 // list only faulted rows 216 psStringAppend(&query, " %s", "AND detProcessedImfile.fault != 0"); 213 psStringAppend(&query, " %s", " detProcessedImfile.fault != 0"); 217 214 } else { 218 215 // don't list faulted rows 219 psStringAppend(&query, " %s", " ANDdetProcessedImfile.fault = 0");216 psStringAppend(&query, " %s", " detProcessedImfile.fault = 0"); 220 217 } 221 218
Note:
See TracChangeset
for help on using the changeset viewer.
