Changeset 10118
- Timestamp:
- Nov 20, 2006, 4:24:42 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/pzgetimfiles.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/pzgetimfiles.c
r10063 r10118 26 26 #include <stdlib.h> 27 27 28 #include "pxtag.h" 28 29 #include "pxtools.h" 29 30 #include "pzgetimfiles.h" … … 361 362 // copy the summitExp row into newExp in order to create a new exp_tag 362 363 { 364 psString exp_tag = pxGenExpTag(config, filesetid); 365 if (!exp_tag) { 366 // rollback 367 if (!psDBRollback(config->dbh)) { 368 psError(PS_ERR_UNKNOWN, false, "database error"); 369 } 370 psError(PS_ERR_UNKNOWN, false, "database error"); 371 return false; 372 } 373 363 374 char *query = 364 375 "INSERT INTO newExp" 365 376 " SElECT" 366 " NULL," // exp_tag377 " '%s'," // exp_tag 367 378 " summitExp.exp_id," 368 379 " summitExp.camera," … … 377 388 " AND summitExp.telescope = '%s'"; 378 389 379 if (!p_psDBRunQuery(config->dbh, query)) { 380 // rollback 381 if (!psDBRollback(config->dbh)) { 382 psError(PS_ERR_UNKNOWN, false, "database error"); 383 } 384 psError(PS_ERR_UNKNOWN, false, "database error"); 385 return false; 386 } 390 if (!p_psDBRunQuery(config->dbh, query, exp_tag, filesetid, camera, telescope)) { 391 // rollback 392 if (!psDBRollback(config->dbh)) { 393 psError(PS_ERR_UNKNOWN, false, "database error"); 394 } 395 psError(PS_ERR_UNKNOWN, false, "database error"); 396 psFree(exp_tag); 397 return false; 398 } 399 psFree(exp_tag); 387 400 388 401 // sanity check: we should have inserted only one row … … 403 416 char *query = 404 417 "UPDATE pzPendingImfile" 405 " SET exp_tag = LAST_INSERT_ID()" 418 " SET exp_tag = (SELECT exp_tag from newExp" 419 " WHERE exp_id = '%s'" 420 " AND camera = '%s'" 421 " AND telescope = '%s')" 406 422 " WHERE" 407 423 " exp_id = '%s'" 408 424 " AND camera = '%s'" 409 425 " AND telescope = '%s'"; 410 if (!p_psDBRunQuery(config->dbh, query, filesetid, camera, telescope )) {426 if (!p_psDBRunQuery(config->dbh, query, filesetid, camera, telescope, filesetid, camera, telescope)) { 411 427 // rollback 412 428 if (!psDBRollback(config->dbh)) {
Note:
See TracChangeset
for help on using the changeset viewer.
