Changeset 25835 for trunk/ippTools/src/pxcam.c
- Timestamp:
- Oct 14, 2009, 11:06:18 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/pxcam.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/pxcam.c
r24866 r25835 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 char *note) 225 155 { 226 156 PS_ASSERT_PTR_NON_NULL(config, false); … … 245 175 "dirty", //workdir_state 246 176 label ? label : "NULL", 177 data_group ? data_group : "NULL", 178 dist_group ? dist_group : "NULL", 247 179 recipe ? recipe : "NULL", 248 180 expgroup ? expgroup : "NULL", … … 250 182 tess_id ? tess_id : "NULL", 251 183 end_stage ? end_stage : "NULL", 184 note ? note : "NULL", 252 185 (long long)chip_id 253 186 )) {
Note:
See TracChangeset
for help on using the changeset viewer.
