Changeset 27840 for branches/simtest_nebulous_branches/ippTools/src/pxcam.c
- 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/pxcam.c (modified) (6 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/pxcam.c
r24866 r27840 76 76 bool pxcamGetSearchArgs (pxConfig *config, psMetadata *where) { 77 77 78 PXOPT_COPY_S64(config->args, where, "-chip_id", "chipRun.chip_id", "==");79 PXOPT_COPY_S64(config->args, where, "-exp_id", "rawExp.exp_id", "==");80 PXOPT_COPY_STR(config->args, where, "-exp_name", "rawExp.exp_name", "==");81 PXOPT_COPY_STR(config->args, where, "-inst", "rawExp.camera", "==");82 PXOPT_COPY_STR(config->args, where, "-telescope", "rawExp.telescope", "==");83 PXOPT_COPY_TIME(config->args, where, "-dateobs_begin", "rawExp.dateobs", ">=");84 PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "rawExp.dateobs", "<=");85 PXOPT_COPY_STR(config->args, where, "-exp_tag", "rawExp.exp_tag", "==");86 PXOPT_COPY_STR(config->args, where, "-exp_type", "rawExp.exp_type", "==");87 PXOPT_COPY_STR(config->args, where, "-comment", "rawExp.comment", "LIKE");88 PXOPT_COPY_STR(config->args, where, "-filelevel", "rawExp.filelevel", "==");89 PXOPT_COPY_STR(config->args, where, "-filter", "rawExp.filter", " ==");78 PXOPT_COPY_S64(config->args, where, "-chip_id", "chipRun.chip_id", "=="); 79 PXOPT_COPY_S64(config->args, where, "-exp_id", "rawExp.exp_id", "=="); 80 PXOPT_COPY_STR(config->args, where, "-exp_name", "rawExp.exp_name", "=="); 81 PXOPT_COPY_STR(config->args, where, "-inst", "rawExp.camera", "=="); 82 PXOPT_COPY_STR(config->args, where, "-telescope", "rawExp.telescope", "=="); 83 PXOPT_COPY_TIME(config->args, where, "-dateobs_begin", "rawExp.dateobs", ">="); 84 PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "rawExp.dateobs", "<="); 85 PXOPT_COPY_STR(config->args, where, "-exp_tag", "rawExp.exp_tag", "=="); 86 PXOPT_COPY_STR(config->args, where, "-exp_type", "rawExp.exp_type", "=="); 87 PXOPT_COPY_STR(config->args, where, "-comment", "rawExp.comment", "LIKE"); 88 PXOPT_COPY_STR(config->args, where, "-filelevel", "rawExp.filelevel", "=="); 89 PXOPT_COPY_STR(config->args, where, "-filter", "rawExp.filter", "LIKE"); 90 90 PXOPT_COPY_F64(config->args, where, "-airmass_min", "rawExp.airmass", ">="); 91 91 PXOPT_COPY_F64(config->args, where, "-airmass_max", "rawExp.airmass", "<"); … … 141 141 } 142 142 143 144 bool pxcamRunSetStateByQuery(pxConfig *config, psMetadata *where, const char *state)145 {146 PS_ASSERT_PTR_NON_NULL(config, false);147 PS_ASSERT_PTR_NON_NULL(state, false);148 149 // check that state is a valid string value150 if (!pxIsValidState(state)) {151 psError(PS_ERR_UNKNOWN, false,152 "invalid chipRun state: %s", state);153 return false;154 }155 156 psString query = psStringCopy("UPDATE camRun JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) SET camRun.state = '%s'");157 158 if (where) {159 psString whereClause = psDBGenerateWhereSQL(where, NULL);160 psStringAppend(&query, " %s", whereClause);161 psFree(whereClause);162 }163 164 if (!p_psDBRunQueryF(config->dbh, query, state)) {165 psFree(query);166 psError(PS_ERR_UNKNOWN, false, "database error");167 return false;168 }169 170 psFree(query);171 172 return true;173 }174 175 176 bool pxcamRunSetLabel(pxConfig *config, psS64 cam_id, const char *label)177 {178 PS_ASSERT_PTR_NON_NULL(config, false);179 // note label == NULL should be explicitly allowed180 181 char *query = "UPDATE camRun SET camRun.label = '%s' WHERE cam_id = %" PRId64;182 if (!p_psDBRunQueryF(config->dbh, query, label, cam_id)) {183 psError(PS_ERR_UNKNOWN, false,184 "failed to change state for cam_id %" PRId64, cam_id);185 return false;186 }187 188 return true;189 }190 191 bool pxcamRunSetLabelByQuery(pxConfig *config, psMetadata *where, const char *label)192 {193 PS_ASSERT_PTR_NON_NULL(config, false);194 // note label == NULL should be explicitly allowed195 196 psString query = psStringCopy("UPDATE camRun JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) SET camRun.label = '%s'");197 198 if (where) {199 psString whereClause = psDBGenerateWhereSQL(where, NULL);200 psStringAppend(&query, " %s", whereClause);201 psFree(whereClause);202 }203 204 if (!p_psDBRunQueryF(config->dbh, query, label)) {205 psFree(query);206 psError(PS_ERR_UNKNOWN, false, "database error");207 return false;208 }209 210 psFree(query);211 212 return true;213 }214 215 216 143 bool pxcamQueueByChipID(pxConfig *config, 217 144 psS64 chip_id, 218 145 char *workdir, 219 146 char *label, 147 char *data_group, 148 char *dist_group, 220 149 char *recipe, 221 150 char *expgroup, 222 151 char *dvodb, 223 152 char *tess_id, 224 char *end_stage) 153 char *end_stage, 154 psS64 magicked, 155 char *note) 225 156 { 226 157 PS_ASSERT_PTR_NON_NULL(config, false); … … 232 163 psMemSetPersistent(query, true); 233 164 if (!query) { 234 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");165 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 235 166 return false; 236 167 } … … 238 169 239 170 // queue the exp 240 // XXX chip_id isbeing cast here work around psS64 have a different type171 // XXX chip_id and magicked are being cast here work around psS64 have a different type 241 172 // different on 32/64 242 173 if (!p_psDBRunQueryF(config->dbh, query, … … 245 176 "dirty", //workdir_state 246 177 label ? label : "NULL", 178 data_group ? data_group : "NULL", 179 dist_group ? dist_group : "NULL", 247 180 recipe ? recipe : "NULL", 248 181 expgroup ? expgroup : "NULL", … … 250 183 tess_id ? tess_id : "NULL", 251 184 end_stage ? end_stage : "NULL", 185 (long long) magicked, 186 note ? note : "NULL", 252 187 (long long)chip_id 253 188 )) {
Note:
See TracChangeset
for help on using the changeset viewer.
