Changeset 20734 for trunk/ippTools/src/magictool.c
- Timestamp:
- Nov 13, 2008, 2:56:00 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/magictool.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/magictool.c
r20703 r20734 155 155 PXOPT_COPY_F32(config->args, where, "-good_frac", "warpSkyfile.good_frac", ">="); 156 156 157 psString whereClause = NULL; // WHERE conditions 157 158 if (psListLength(where->list)) { 158 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 159 psStringAppend(&query, " AND %s", whereClause); 159 whereClause = psDBGenerateWhereConditionSQL(where, NULL); 160 psStringPrepend(&whereClause, "\n AND "); 161 } 162 psFree(where); 163 164 if (!p_psDBRunQuery(config->dbh, query, whereClause)) { 165 psError(PS_ERR_UNKNOWN, false, "database error"); 160 166 psFree(whereClause); 161 }162 psFree(where);163 164 psString groupby = pxDataGet("magictool_definebyquery_temp_insert_groupby.sql");165 if (!groupby) {166 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");167 167 psFree(query); 168 168 return false; 169 169 } 170 171 psStringAppend(&query, " %s", groupby); 172 psFree(groupby); 173 174 if (!p_psDBRunQuery(config->dbh, query)) { 175 psError(PS_ERR_UNKNOWN, false, "database error"); 176 psFree(query); 177 return false; 178 } 170 psFree(whereClause); 179 171 psFree(query); 180 172 } … … 182 174 // Get list of exposures ready to magic 183 175 { 184 psString query = pxDataGet("magictool_definebyquery_select _part1.sql");176 psString query = pxDataGet("magictool_definebyquery_select.sql"); 185 177 if (!query) { 186 178 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); … … 188 180 } 189 181 182 psString whereClause = NULL; // WHERE conditions 190 183 { 191 184 psMetadata *where = psMetadataAlloc(); … … 194 187 195 188 if (psListLength(where->list)) { 196 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 197 psStringAppend(&query, " AND %s", whereClause); 198 psFree(whereClause); 189 whereClause = psDBGenerateWhereConditionSQL(where, NULL); 190 psStringPrepend(&whereClause, "\n AND "); 199 191 } 200 192 psFree(where); 201 193 } 202 194 203 psString part2 = pxDataGet("magictool_definebyquery_select_part2.sql"); 204 if (!part2) { 205 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 206 return false; 207 } 208 209 psStringAppend(&query, " %s", part2); 210 psFree(part2); 211 212 if (!p_psDBRunQuery(config->dbh, query)) { 195 // Only concern ourselves with exposures that have all diffs completed, unless we're told to only take 196 // what's available. 197 PXOPT_LOOKUP_BOOL(available, config->args, "-available", false); 198 if (!available) { 199 psStringAppend(&query, " AND num_done = num_todo"); 200 } 201 202 if (!p_psDBRunQuery(config->dbh, query, whereClause ? whereClause : "")) { 213 203 psError(PS_ERR_UNKNOWN, false, "database error"); 204 psFree(whereClause); 214 205 psFree(query); 215 206 return false; 216 207 } 217 psFree(query); 218 } 208 psFree(whereClause); 209 psFree(query); 210 } 211 219 212 psArray *output = p_psDBFetchResult(config->dbh); 220 213 if (!output) { … … 236 229 return true; 237 230 } 231 232 // Parse the list of exposures ready to magic 238 233 239 234 if (!psDBTransaction(config->dbh)) {
Note:
See TracChangeset
for help on using the changeset viewer.
