Changeset 24149 for branches/pap_magic/ippTools/src/magictool.c
- Timestamp:
- May 12, 2009, 4:07:48 PM (17 years ago)
- File:
-
- 1 edited
-
branches/pap_magic/ippTools/src/magictool.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap_magic/ippTools/src/magictool.c
r24136 r24149 131 131 psMetadata *diffWhere = psMetadataAlloc(); // WHERE conditions for diffRuns 132 132 PXOPT_COPY_STR(config->args, diffWhere, "-diff_label", "diffRun.label", "=="); 133 PXOPT_COPY_S64(config->args, diffWhere, "-diff_id", "diff_id", "=="); 133 134 134 135 psMetadata *queryWhere = psMetadataAlloc(); // WHERE conditions for everything else … … 391 392 // required 392 393 PXOPT_LOOKUP_S64(magic_id, config->args, "-magic_id", true, false); 393 PXOPT_LOOKUP_S64(diff_id, config->args, "-diff_id", true, false);394 394 PXOPT_LOOKUP_STR(node, config->args, "-node", true, false); 395 395 … … 397 397 config->dbh, 398 398 magic_id, 399 diff_id,400 399 node 401 400 ); … … 612 611 PS_ASSERT_PTR_NON_NULL(config, false); 613 612 614 psMetadata *where = psMetadataAlloc(); 615 PXOPT_COPY_S64(config->args, where, "-magic_id", "magic_id", "=="); 616 PXOPT_COPY_STR(config->args, where, "-node", "node", "=="); 613 // Regrettably, there are multiple WHERE hooks which call the same things different names 614 psMetadata *templatesWhere = psMetadataAlloc(); // WHERE for selecting template 615 psMetadata *magicWhere = psMetadataAlloc(); // WHERE for selecting magic runs 616 psMetadata *finalWhere = psMetadataAlloc(); // WHERE at end 617 618 PXOPT_COPY_S64(config->args, templatesWhere, "-magic_id", "magicRun.magic_id", "=="); 619 PXOPT_COPY_STR(config->args, templatesWhere, "-node", "diffInputSkyfile.skycell_id", "=="); 620 621 PXOPT_COPY_S64(config->args, magicWhere, "-magic_id", "magicRun.magic_id", "=="); 622 PXOPT_COPY_STR(config->args, magicWhere, "-node", "magicTree.node", "=="); 623 624 PXOPT_COPY_S64(config->args, finalWhere, "-magic_id", "magicRun.magic_id", "=="); 625 PXOPT_COPY_STR(config->args, finalWhere, "-node", "magicInputs.node", "=="); 617 626 618 627 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); … … 625 634 } 626 635 627 if (psListLength(where->list)) { 628 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 629 psStringAppend(&query, " AND %s", whereClause); 636 psString templatesWhereStr = psStringCopy(""); // WHERE for selecting template 637 psString magicWhereStr = psStringCopy(""); // WHERE for selecting magic runs 638 639 if (psListLength(templatesWhere->list)) { 640 psString whereClause = psDBGenerateWhereConditionSQL(templatesWhere, NULL); 641 psStringAppend(&templatesWhereStr, "\nAND %s", whereClause); 630 642 psFree(whereClause); 631 643 } 632 psFree(where); 644 psFree(templatesWhere); 645 646 if (psListLength(magicWhere->list)) { 647 psString whereClause = psDBGenerateWhereConditionSQL(magicWhere, NULL); 648 psStringAppend(&magicWhereStr, "\nWHERE %s", whereClause); 649 psFree(whereClause); 650 } 651 psFree(magicWhere); 652 653 if (psListLength(finalWhere->list)) { 654 psString whereClause = psDBGenerateWhereConditionSQL(finalWhere, NULL); 655 psStringAppend(&query, "\nWHERE %s", whereClause); 656 psFree(whereClause); 657 } 658 psFree(finalWhere); 633 659 634 660 // treat limit == 0 as "no limit" … … 639 665 } 640 666 641 if (!p_psDBRunQuery(config->dbh, query)) { 642 psError(PS_ERR_UNKNOWN, false, "database error"); 667 if (!p_psDBRunQueryF(config->dbh, query, 668 templatesWhereStr, templatesWhereStr, 669 magicWhereStr, magicWhereStr)) { 670 psError(PS_ERR_UNKNOWN, false, "database error"); 671 psFree(templatesWhereStr); 672 psFree(magicWhereStr); 643 673 psFree(query); 644 674 return false; 645 675 } 676 psFree(templatesWhereStr); 677 psFree(magicWhereStr); 646 678 psFree(query); 647 679 … … 964 996 965 997 // optional 966 PXOPT_LOOKUP_STR( uri, config->args, "-uri", false, false);998 PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", false, false); 967 999 968 1000 // default values … … 972 1004 magic_id, 973 1005 node, 974 uri,1006 path_base, 975 1007 fault 976 1008 )) {
Note:
See TracChangeset
for help on using the changeset viewer.
