Changeset 15606
- Timestamp:
- Nov 13, 2007, 11:19:41 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/flatcorr.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/flatcorr.c
r15583 r15606 36 36 static bool pendingMode(pxConfig *config); 37 37 static bool updateMode(pxConfig *config); 38 39 static bool setflatcorrpRunState(pxConfig *config, psS64 corr_id, const char *state); 38 40 39 41 # define MODECASE(caseName, func) \ … … 263 265 label 264 266 )) { 267 if (!psDBRollback(config->dbh)) { 268 psError(PS_ERR_UNKNOWN, false, "database error"); 269 } 265 270 psError(PS_ERR_UNKNOWN, false, "database error"); 266 271 return false; … … 276 281 psS64 exp_id = psMetadataLookupS64(&status, md, "exp_id"); 277 282 if (!status) { 283 if (!psDBRollback(config->dbh)) { 284 psError(PS_ERR_UNKNOWN, false, "database error"); 285 } 278 286 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_id"); 279 287 psFree(output); … … 298 306 chip_id 299 307 )) { 308 if (!psDBRollback(config->dbh)) { 309 psError(PS_ERR_UNKNOWN, false, "database error"); 310 } 300 311 psError(PS_ERR_UNKNOWN, false, "database error"); 301 312 return false; … … 305 316 psFree(output); 306 317 318 // set the flatcorrRun to a state of 'run' 319 if (!setflatcorrpRunState(config, corr_id, "run")) { 320 if (!psDBRollback(config->dbh)) { 321 psError(PS_ERR_UNKNOWN, false, "database error"); 322 } 323 psError(PS_ERR_UNKNOWN, false, "failed to set run state"); 324 return false; 325 } 326 307 327 if (!psDBCommit(config->dbh)) { 308 328 psError(PS_ERR_UNKNOWN, false, "database error"); … … 326 346 return false; 327 347 } 348 349 350 static bool setflatcorrpRunState(pxConfig *config, psS64 corr_id, const char *state) 351 { 352 PS_ASSERT_PTR_NON_NULL(state, false); 353 354 // check that state is a valid string value 355 if (!( 356 (strncmp(state, "run", 4) == 0) 357 || (strncmp(state, "stop", 5) == 0) 358 || (strncmp(state, "reg", 4) == 0) 359 ) 360 ) { 361 psError(PS_ERR_UNKNOWN, false, "invalid state: %s", state); 362 return false; 363 } 364 365 char *query = "UPDATE flatcorrpRun SET state = '%s' WHERE corr_id = %" PRId64; 366 if (!p_psDBRunQuery(config->dbh, query, state, corr_id)) { 367 psError(PS_ERR_UNKNOWN, false, 368 "failed to change state for corr_id %" PRId64, corr_id); 369 return false; 370 } 371 372 return true; 373 }
Note:
See TracChangeset
for help on using the changeset viewer.
