Changeset 12177
- Timestamp:
- Mar 1, 2007, 5:47:00 PM (19 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 1 added
- 4 edited
-
Makefile.am (modified) (1 diff)
-
chipqueue.c (added)
-
chiptool.c (modified) (1 diff)
-
chiptool.h (modified) (1 diff)
-
regtool.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/Makefile.am
r12131 r12177 50 50 pxdata.c \ 51 51 pxio.c \ 52 pxtag.c 52 pxtag.c \ 53 chipqueuerawexp.c 53 54 54 55 # for pxtools.h -
trunk/ippTools/src/chiptool.c
r12174 r12177 251 251 252 252 // queue the exp 253 if (!p_psDBRunQuery(config->dbh, queuerawexp_query, 254 label ? label : "NULL", 255 recipe ? recipe : "NULL", 256 expgroup ? expgroup : "NULL", 257 dvodb ? dvodb : "NULL", 258 exp_tag 259 )) { 260 psError(PS_ERR_UNKNOWN, false, "database error"); 261 psFree(queuerawimfile_query); 262 psFree(queuerawexp_query); 263 psFree(output); 264 return false; 265 } 266 267 // just to be safe, we should have changed at least one row 268 if (psDBAffectedRows(config->dbh) < 1) { 253 if (!chipQueueRawExp(config, exp_tag, label, recipe, expgroup, dvodb)) { 269 254 if (!psDBRollback(config->dbh)) { 270 255 psError(PS_ERR_UNKNOWN, false, "database error"); 271 256 } 272 257 psError(PS_ERR_UNKNOWN, false, 273 "no rows affected - should have changed at least one row"); 274 psFree(queuerawimfile_query); 275 psFree(queuerawexp_query); 276 psFree(output); 277 return false; 278 } 279 280 // queue the imfiles for the exp we just queued 281 if (!p_psDBRunQuery(config->dbh, queuerawimfile_query)) { 282 psError(PS_ERR_UNKNOWN, false, "database error"); 283 psFree(queuerawimfile_query); 284 psFree(queuerawexp_query); 285 psFree(output); 286 return false; 287 } 288 289 // just to be safe, we should have changed at least one row 290 if (psDBAffectedRows(config->dbh) < 1) { 291 if (!psDBRollback(config->dbh)) { 292 psError(PS_ERR_UNKNOWN, false, "database error"); 293 } 294 psError(PS_ERR_UNKNOWN, false, 295 "no rows affected - should have changed at least one row"); 258 "failed to trying to queue exp_tag: %s", exp_tag); 296 259 psFree(queuerawimfile_query); 297 260 psFree(queuerawexp_query); -
trunk/ippTools/src/chiptool.h
r12025 r12177 37 37 pxConfig *chiptoolConfig(pxConfig *config, int argc, char **argv); 38 38 39 bool chipQueueRawExp(pxConfig *config, psString exp_tag, psString label, psString recipe, psString expgroup, psString dvodb); 40 39 41 #endif // CHIPTOOL_H -
trunk/ippTools/src/regtool.c
r12174 r12177 27 27 #include "pxdata.h" 28 28 #include "regtool.h" 29 #include "chiptool.h" 29 30 30 31 static bool pendingimfileMode(pxConfig *config); … … 40 41 41 42 // static guidePendingExpRow *newToP1PendingExp(newExpRow *newExp); 42 static chipPendingExpRow *newTochipPendingExp(pxConfig *config, newExpRow *newExp);43 static chipPendingImfileRow *rawImfileTochipPendingImfile(pxConfig *config, psS64 chip_id, rawImfileRow *rawImfile);43 //static chipPendingExpRow *newTochipPendingExp(pxConfig *config, newExpRow *newExp); 44 //static chipPendingImfileRow *rawImfileTochipPendingImfile(pxConfig *config, psS64 chip_id, rawImfileRow *rawImfile); 44 45 45 46 static rawExpRow *newToRawExp(pxConfig *config, newExpRow *exp); … … 636 637 } 637 638 639 psFree(newExp); 640 638 641 // if this is a detrend image don't put it in the chip queue (and we're 639 642 // done) 640 643 if (detrend) { 641 psFree(newExp);642 644 continue; 643 645 } 644 646 645 647 // insert an entry into the chipPendingExp table 646 chipPendingExpRow *chipPendingExp = newTochipPendingExp(config, newExp); 647 if (!chipPendingExp) { 648 psError(PS_ERR_UNKNOWN, false, "failed to convert newExp to chipPendingExp"); 649 psFree(newExp); 650 psFree(output); 651 return false; 652 } 653 654 // insert the chipPendingExp object into the database 655 if (!chipPendingExpInsertObject(config->dbh, chipPendingExp)) { 648 if (!chipQueueRawExp(config, exp_tag, NULL, NULL, NULL, NULL)) { 656 649 // rollback 657 650 if (!psDBRollback(config->dbh)) { 658 651 psError(PS_ERR_UNKNOWN, false, "database error"); 659 652 } 660 psError(PS_ERR_UNKNOWN, false, "database error"); 661 psFree(chipPendingExp); 662 psFree(newExp); 653 psError(PS_ERR_UNKNOWN, false, "failed to queue chipPendingExp"); 663 654 psFree(output); 664 655 return false; 665 656 } 666 667 // get the chip_id for the imfiles668 psS64 chip_id = psDBLastInsertID(config->dbh);669 psFree(chipPendingExp);670 671 // find all of the rawImfiles associated with the chipPendingExp object672 psArray *rawImfiles = NULL;673 {674 // build a query to search by exp_tag675 psMetadata *where = psMetadataAlloc();676 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", newExp->exp_tag)) {677 // rollback678 if (!psDBRollback(config->dbh)) {679 psError(PS_ERR_UNKNOWN, false, "database error");680 }681 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");682 psFree(where);683 psFree(newExp);684 psFree(output);685 return false;686 }687 rawImfiles = rawImfileSelectRowObjects(config->dbh, where, 0);688 psFree(where);689 }690 // sanity check that least results were found691 if (!rawImfiles) {692 // rollback693 if (!psDBRollback(config->dbh)) {694 psError(PS_ERR_UNKNOWN, false, "database error");695 }696 psError(PS_ERR_UNKNOWN, false, "database error");697 psFree(newExp);698 psFree(output);699 return false;700 }701 // sanity check the number of rawImfiles found702 if (psArrayLength(rawImfiles) != newExp->imfiles) {703 // rollback704 if (!psDBRollback(config->dbh)) {705 psError(PS_ERR_UNKNOWN, false, "database error");706 }707 psError(PS_ERR_UNKNOWN, false, "found %ld rawImfiles but expected %d",708 psArrayLength(rawImfiles), newExp->imfiles);709 psFree(newExp);710 psFree(output);711 return false;712 }713 // convert the rawImfiles into chipPendingImfiles and insert them into714 // the database715 for (long i = 0; i < psArrayLength(rawImfiles); i++) {716 rawImfileRow *rawImfile = rawImfiles->data[i];717 chipPendingImfileRow *pendingImfile = rawImfileTochipPendingImfile(config, chip_id, rawImfile);718 if (!chipPendingImfileInsertObject(config->dbh, pendingImfile)){719 // rollback720 if (!psDBRollback(config->dbh)) {721 psError(PS_ERR_UNKNOWN, false, "database error");722 }723 psError(PS_ERR_UNKNOWN, false, "database error");724 psFree(pendingImfile);725 psFree(rawImfiles);726 psFree(newExp);727 psFree(output);728 }729 psFree(pendingImfile);730 }731 psFree(rawImfiles);732 psFree(newExp);733 657 } 734 658 … … 879 803 880 804 805 #if 0 881 806 static chipPendingExpRow *newTochipPendingExp(pxConfig *config, newExpRow *exp) 882 807 { … … 914 839 ); 915 840 } 841 #endif 916 842 917 843
Note:
See TracChangeset
for help on using the changeset viewer.
