Changeset 15340
- Timestamp:
- Oct 19, 2007, 3:23:46 PM (19 years ago)
- Location:
- trunk/ippTools
- Files:
-
- 4 edited
-
scripts/magictest.sh (modified) (1 diff)
-
share/magictool_tomask.sql (modified) (1 diff)
-
src/magictool.c (modified) (1 diff)
-
src/magictoolConfig.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/scripts/magictest.sh
r15337 r15340 10 10 magictool -addinputskyfile -magic_id 1 -diff_id 2 -node b || exit 1 11 11 magictool -inputtree -magic_id 1 -dep_file magic_dep.md 12 magictool -addresult -magic_id 1 -node a -uri file:///foo/a 13 magictool -addresult -magic_id 1 -node b -uri file:///foo/b 14 magictool -addresult -magic_id 1 -node root -uri file:///foo/root 12 15 13 16 magictool -updaterun -state run -magic_id 1 || exit 1 -
trunk/ippTools/share/magictool_tomask.sql
r15338 r15340 1 1 SELECT 2 2 magic_id 3 FROM magicTree 3 FROM magicRun 4 JOIN magicTree 5 USING(magic_id) 4 6 LEFT JOIN magicNodeResult 5 7 USING(magic_id, node) 8 WHERE 9 magicRun.state = 'run' 6 10 GROUP BY 7 11 magic_id -
trunk/ippTools/src/magictool.c
r15339 r15340 572 572 { 573 573 PS_ASSERT_PTR_NON_NULL(config, false); 574 575 bool status = false; 576 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 577 if (!status) { 578 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 579 return false; 580 } 581 582 // look for "inputs" that need to processed 583 psString query = pxDataGet("magictool_tomask.sql"); 584 if (!query) { 585 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 586 return false; 587 } 588 589 // treat limit == 0 as "no limit" 590 if (limit) { 591 psString limitString = psDBGenerateLimitSQL(limit); 592 psStringAppend(&query, " %s", limitString); 593 psFree(limitString); 594 } 595 596 if (!p_psDBRunQuery(config->dbh, query)) { 597 psError(PS_ERR_UNKNOWN, false, "database error"); 598 psFree(query); 599 return false; 600 } 601 psFree(query); 602 603 psArray *output = p_psDBFetchResult(config->dbh); 604 if (!output) { 605 psErrorCode err = psErrorCodeLast(); 606 switch (err) { 607 case PS_ERR_DB_CLIENT: 608 psError(PXTOOLS_ERR_SYS, false, "database error"); 609 case PS_ERR_DB_SERVER: 610 psError(PXTOOLS_ERR_PROG, false, "database error"); 611 default: 612 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 613 } 614 615 return false; 616 } 617 if (!psArrayLength(output)) { 618 psTrace("magictool", PS_LOG_INFO, "no rows found"); 619 psFree(output); 620 return true; 621 } 622 623 bool simple = false; 624 { 625 bool status = false; 626 simple = psMetadataLookupBool(&status, config->args, "-simple"); 627 if (!status) { 628 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 629 return false; 630 } 631 } 632 633 if (psArrayLength(output)) { 634 if (!convertIdToStr(output)) { 635 psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings"); 636 psFree(output); 637 return false; 638 } 639 640 // negative simple so the default is true 641 if (!ippdbPrintMetadatas(stdout, output, "toprocess", !simple)) { 642 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 643 psFree(output); 644 return false; 645 } 646 } 647 648 psFree(output); 649 574 650 return true; 575 651 } -
trunk/ippTools/src/magictoolConfig.c
r14537 r15340 111 111 // -tomask 112 112 psMetadata *tomaskArgs = psMetadataAlloc(); 113 psMetadataAddStr(tomaskArgs, PS_LIST_TAIL, "-magic_id", 0,114 "search by magic ID", NULL);115 113 psMetadataAddU64(tomaskArgs, PS_LIST_TAIL, "-limit", 0, 116 114 "limit result set to N items", 0);
Note:
See TracChangeset
for help on using the changeset viewer.
