Changeset 23861 for trunk/ippTools/src/disttool.c
- Timestamp:
- Apr 14, 2009, 3:14:27 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/disttool.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/disttool.c
r23842 r23861 41 41 static bool pendingfilesetMode(pxConfig *config); 42 42 static bool addfilesetMode(pxConfig *config); 43 static bool pendingdatastoresMode(pxConfig *config); 43 44 44 45 # define MODECASE(caseName, func) \ … … 71 72 MODECASE(DISTTOOL_MODE_PENDINGFILESET, pendingfilesetMode); 72 73 MODECASE(DISTTOOL_MODE_ADDFILESET, addfilesetMode); 74 MODECASE(DISTTOOL_MODE_PENDINGDATASTORES, pendingdatastoresMode); 73 75 default: 74 76 psAbort("invalid option (this should not happen)"); … … 893 895 } 894 896 897 static bool pendingdatastoresMode(pxConfig *config) 898 { 899 PS_ASSERT_PTR_NON_NULL(config, false); 900 #ifdef notyet 901 902 psMetadata *where = psMetadataAlloc(); 903 PXOPT_COPY_S64(config->args, where, "-dist_id", "dist_id", "=="); 904 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); 905 906 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 907 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 908 909 // look for "inputs" that need to processed 910 psString query = pxDataGet("disttool_pendingfileset.sql"); 911 if (!query) { 912 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 913 return false; 914 } 915 916 if (psListLength(where->list)) { 917 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 918 psStringAppend(&query, " AND %s", whereClause); 919 psFree(whereClause); 920 } 921 psFree(where); 922 923 // treat limit == 0 as "no limit" 924 if (limit) { 925 psString limitString = psDBGenerateLimitSQL(limit); 926 psStringAppend(&query, " %s", limitString); 927 psFree(limitString); 928 } 929 930 if (!p_psDBRunQuery(config->dbh, query)) { 931 psError(PS_ERR_UNKNOWN, false, "database error"); 932 psFree(query); 933 return false; 934 } 935 psFree(query); 936 937 psArray *output = p_psDBFetchResult(config->dbh); 938 if (!output) { 939 psErrorCode err = psErrorCodeLast(); 940 switch (err) { 941 case PS_ERR_DB_CLIENT: 942 psError(PXTOOLS_ERR_SYS, false, "database error"); 943 case PS_ERR_DB_SERVER: 944 psError(PXTOOLS_ERR_PROG, false, "database error"); 945 default: 946 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 947 } 948 949 return false; 950 } 951 if (!psArrayLength(output)) { 952 psTrace("disttool", PS_LOG_INFO, "no rows found"); 953 psFree(output); 954 return true; 955 } 956 957 if (psArrayLength(output)) { 958 // negative simple so the default is true 959 if (!ippdbPrintMetadatas(stdout, output, "pendingfileset", !simple)) { 960 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 961 psFree(output); 962 return false; 963 } 964 } 965 966 psFree(output); 967 # endif // notdef 968 return true; 969 }
Note:
See TracChangeset
for help on using the changeset viewer.
