Changeset 12066
- Timestamp:
- Feb 26, 2007, 4:53:52 PM (19 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/dettool.c
r12065 r12066 35 35 static bool definebydetrunMode(pxConfig *config); 36 36 static bool runsMode(pxConfig *config); 37 static bool orphanrunMode(pxConfig *config);37 static bool childlessrunMode(pxConfig *config); 38 38 static bool inputMode(pxConfig *config); 39 39 static bool rawMode(pxConfig *config); … … 107 107 MODECASE(DETTOOL_MODE_DEFINEBYDETRUN, definebydetrunMode); 108 108 MODECASE(DETTOOL_MODE_RUNS, runsMode); 109 MODECASE(DETTOOL_MODE_ ORPHANRUN, orphanrunMode);109 MODECASE(DETTOOL_MODE_CHILDLESSRUN, childlessrunMode); 110 110 MODECASE(DETTOOL_MODE_INPUT, inputMode); 111 111 MODECASE(DETTOOL_MODE_RAW, rawMode); … … 492 492 } 493 493 494 // start a transaction so we don't end up with orphaned det_ids494 // start a transaction so we don't end up with childlessed det_ids 495 495 if (!psDBTransaction(config->dbh)) { 496 496 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1142 1142 } 1143 1143 1144 // start a transaction so we don't end up with orphaned det_ids1144 // start a transaction so we don't end up with childlessed det_ids 1145 1145 if (!psDBTransaction(config->dbh)) { 1146 1146 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1572 1572 1573 1573 1574 // start a transaction so we don't end up with orphaned det_ids1574 // start a transaction so we don't end up with childlessed det_ids 1575 1575 if (!psDBTransaction(config->dbh)) { 1576 1576 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1720 1720 } 1721 1721 1722 static bool orphanrunMode(pxConfig *config)1722 static bool childlessrunMode(pxConfig *config) 1723 1723 { 1724 1724 PS_ASSERT_PTR_NON_NULL(config, false); 1725 1725 1726 bool status = false; 1727 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 1728 if (!status) { 1729 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -limit"); 1730 return false; 1731 } 1732 1726 1733 psString query = psStringCopy( 1727 "SELECT \n"1734 "SELECT DISTINCT\n" 1728 1735 " detRun.*\n" 1729 1736 " FROM detRun\n" 1730 1737 " LEFT JOIN detRun as foo\n" 1731 1738 " ON foo.parent = detRun.det_id\n" 1732 " WHERE" 1733 " detRun.state = 'stop'" 1734 " AND detRun.mode = 'master'" 1739 " WHERE\n" 1740 " detRun.state = 'stop'\n" 1741 " AND detRun.mode = 'master'\n" 1742 " AND foo.det_id IS NULL\n" 1735 1743 ); 1736 1744 … … 1741 1749 } 1742 1750 1751 // treat limit == 0 as "no limit" 1752 if (limit) { 1753 psString limitString = psDBGenerateLimitSQL(limit); 1754 psStringAppend(&query, " %s", limitString); 1755 psFree(limitString); 1756 } 1757 1743 1758 if (!p_psDBRunQuery(config->dbh, query)) { 1744 1759 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1755 1770 if (!psArrayLength(output)) { 1756 1771 // XXX check psError here 1757 psError(PS_ERR_UNKNOWN, false, "no orphandetRun rows found");1772 psError(PS_ERR_UNKNOWN, false, "no childless detRun rows found"); 1758 1773 psFree(output); 1759 1774 return true; -
trunk/ippTools/src/dettool.h
r12065 r12066 30 30 DETTOOL_MODE_DEFINEBYDETRUN, 31 31 DETTOOL_MODE_RUNS, 32 DETTOOL_MODE_ ORPHANRUN,32 DETTOOL_MODE_CHILDLESSRUN, 33 33 DETTOOL_MODE_INPUT, 34 34 DETTOOL_MODE_RAW, -
trunk/ippTools/src/dettoolConfig.c
r12065 r12066 242 242 "use the simple output format", false); 243 243 244 // - orphanrun245 psMetadata * orphanrunArgs = psMetadataAlloc();246 psMetadataAddStr( orphanrunArgs, PS_LIST_TAIL, "-det_type", 0,244 // -childlessrun 245 psMetadata *childlessrunArgs = psMetadataAlloc(); 246 psMetadataAddStr(childlessrunArgs, PS_LIST_TAIL, "-det_type", 0, 247 247 "search for type of detrend run", NULL); 248 psMetadataAddBool(orphanrunArgs, PS_LIST_TAIL, "-simple", 0, 248 psMetadataAddU64(childlessrunArgs, PS_LIST_TAIL, "-limit", 0, 249 "limit result set to N items", 0); 250 psMetadataAddBool(childlessrunArgs, PS_LIST_TAIL, "-simple", 0, 249 251 "use the simple output format", false); 250 252 … … 796 798 PXTOOL_MODE("-raw", DETTOOL_MODE_RAW, rawArgs); 797 799 PXTOOL_MODE("-runs", DETTOOL_MODE_RUNS, runsArgs); 798 PXTOOL_MODE("- orphanrun", DETTOOL_MODE_ORPHANRUN , orphanrunArgs);800 PXTOOL_MODE("-childlessrun", DETTOOL_MODE_CHILDLESSRUN, childlessrunArgs); 799 801 PXTOOL_MODE("-input", DETTOOL_MODE_INPUT, inputArgs); 800 802 PXTOOL_MODE("-toprocessedimfile", DETTOOL_MODE_TOPROCESSEDIMFILE, toprocessedimfileArgs);
Note:
See TracChangeset
for help on using the changeset viewer.
