- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ippTools/src (modified) (1 prop)
-
ippTools/src/detselect.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/ippTools/src
- Property svn:ignore
-
old new 1 *.la 2 *.lo 1 3 .deps 2 4 .gdb_history … … 4 6 Makefile 5 7 Makefile.in 8 addtool 9 caltool 10 camtool 11 chiptool 6 12 config.h 7 13 config.h.in 8 stamp-h1 9 *.la 10 *.lo 14 detselect 15 dettool 16 difftool 17 disttool 18 dqstatstool 19 faketool 20 flatcorr 21 guidetool 22 magicdstool 23 magictool 24 pstamptool 25 pubtool 26 pxadmin 27 pxdata.c 28 pxinject 11 29 pxtoolsErrorCodes.c 12 30 pxtoolsErrorCodes.h 13 pxadmin14 pxinject15 pztool16 31 pzgetexp 17 32 pzgetimfiles 33 pztool 34 receivetool 18 35 regtool 19 guidetool 20 chiptool 21 camtool 36 stacktool 37 stamp-h1 22 38 warptool 23 difftool24 stacktool25 faketool26 dettool27 detselect28 pxdata.c29 magictool30 magicdstool31 caltool32 flatcorr33 pstamptool34 disttool35 receivetool36 37 pubtool
-
- Property svn:ignore
-
branches/simtest_nebulous_branches/ippTools/src/detselect.c
r23998 r27840 135 135 psString query = pxDataGet("detselect_search.sql"); 136 136 if (!query) { 137 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 138 return false; 139 } 140 141 // use psDBGenerateWhereConditionalSQL with AND ... because the SQL ends in a WHERE 142 if (where && psListLength(where->list)) { 143 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 144 psStringAppend(&query, " AND %s", whereClause); 145 psFree(whereClause); 146 } 147 psFree(where); 148 149 // we choose the single detrend image which matches all criteria and has 150 // the latest insertion date 151 152 // unless explicitly specified by the user, list all possible matches 153 if (!unlimit) { 154 psStringAppend(&query, " ORDER BY registered DESC LIMIT 1"); 155 } 156 157 if (!p_psDBRunQuery(config->dbh, query)) { 158 psError(PS_ERR_UNKNOWN, false, "database error"); 159 psFree(query); 160 return false; 161 } 162 psFree(query); 163 164 psArray *output = p_psDBFetchResult(config->dbh); 165 if (!output) { 166 psError(PS_ERR_UNKNOWN, false, "database error"); 167 return false; 168 } 169 if (!psArrayLength(output)) { 170 // XXX check psError here 171 psError(PS_ERR_UNKNOWN, false, "no detrend exposures found"); 172 psFree(output); 173 return true; 174 } 175 176 // negate simple so the default is true 177 if (!ippdbPrintMetadatas(stdout, output, "detExp", !simple)) { 178 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 179 psFree(output); 180 return false; 181 } 182 183 psFree(output); 184 185 return true; 186 } 187 188 static bool selectMode(pxConfig *config) 189 { 190 PS_ASSERT_PTR_NON_NULL(config, false); 191 192 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 193 194 psMetadata *where = psMetadataAlloc(); 195 PXOPT_COPY_STR(config->args, where, "-det_id", "det_id", "=="); 196 PXOPT_COPY_S32(config->args, where, "-iteration", "iteration", "=="); 197 PXOPT_COPY_STR(config->args, where, "-class_id", "class_id", "=="); 198 199 psString query = pxDataGet("detselect_select.sql"); 200 if (!query) { 201 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 137 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 202 138 return false; 203 139 } … … 211 147 psFree(where); 212 148 149 // we choose the single detrend image which matches all criteria and has 150 // the latest insertion date 151 152 // unless explicitly specified by the user, list all possible matches 153 if (!unlimit) { 154 psStringAppend(&query, " ORDER BY registered DESC LIMIT 1"); 155 } 156 157 if (!p_psDBRunQuery(config->dbh, query)) { 158 psError(PS_ERR_UNKNOWN, false, "database error"); 159 psFree(query); 160 return false; 161 } 162 psFree(query); 163 164 psArray *output = p_psDBFetchResult(config->dbh); 165 if (!output) { 166 psError(PS_ERR_UNKNOWN, false, "database error"); 167 return false; 168 } 169 if (!psArrayLength(output)) { 170 // XXX check psError here 171 psError(PS_ERR_UNKNOWN, false, "no detrend exposures found"); 172 psFree(output); 173 return true; 174 } 175 176 // negate simple so the default is true 177 if (!ippdbPrintMetadatas(stdout, output, "detExp", !simple)) { 178 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 179 psFree(output); 180 return false; 181 } 182 183 psFree(output); 184 185 return true; 186 } 187 188 static bool selectMode(pxConfig *config) 189 { 190 PS_ASSERT_PTR_NON_NULL(config, false); 191 192 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 193 194 psMetadata *where = psMetadataAlloc(); 195 PXOPT_COPY_STR(config->args, where, "-det_id", "det_id", "=="); 196 PXOPT_COPY_S32(config->args, where, "-iteration", "iteration", "=="); 197 PXOPT_COPY_STR(config->args, where, "-class_id", "class_id", "=="); 198 199 psString query = pxDataGet("detselect_select.sql"); 200 if (!query) { 201 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 202 return false; 203 } 204 205 // use psDBGenerateWhereConditionalSQL with AND ... because the SQL ends in a WHERE 206 if (where && psListLength(where->list)) { 207 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 208 psStringAppend(&query, " AND %s", whereClause); 209 psFree(whereClause); 210 } 211 psFree(where); 212 213 213 if (!p_psDBRunQuery(config->dbh, query)) { 214 214 psError(PS_ERR_UNKNOWN, false, "database error");
Note:
See TracChangeset
for help on using the changeset viewer.
