Changeset 30206 for trunk/ippTools/src/pztool.c
- Timestamp:
- Jan 6, 2011, 11:32:32 AM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/pztool.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/pztool.c
r30049 r30206 47 47 static bool advanceMode(pxConfig *config); 48 48 49 static bool updatenewexpMode(pxConfig *config); 50 49 51 // static bool copydoneCompleteExp(pxConfig *config); 50 52 static psArray *pzGetPendingCameras(pxConfig *config); … … 83 85 MODECASE(PZTOOL_MODE_TOADVANCE, toadvanceMode); 84 86 MODECASE(PZTOOL_MODE_ADVANCE, advanceMode); 87 MODECASE(PZTOOL_MODE_UPDATENEWEXP, updatenewexpMode); 85 88 default: 86 89 psAbort("invalid option (this should not happen)"); … … 905 908 } 906 909 910 static bool updatenewexpMode(pxConfig *config) 911 { 912 PS_ASSERT_PTR_NON_NULL(config, false); 913 914 psMetadata *where = psMetadataAlloc(); 915 PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "=="); 916 PXOPT_COPY_STR(config->args, where, "-exp_name", "tmp_exp_name", "=="); 917 918 PXOPT_LOOKUP_STR(new_state, config->args, "-set_state", true, false); 919 920 if (strcmp(new_state, "drop") && strcmp(new_state, "run") && strcmp(new_state, "wait")) { 921 psError(PXTOOLS_ERR_ARGUMENTS, true, "%s is not a valid value for -set_state", new_state); 922 psFree(where); 923 return false; 924 } 925 926 if (psListLength(where->list) < 1) { 927 psFree(where); 928 psError(PXTOOLS_ERR_CONFIG, false, "-exp_name or -exp_id is required"); 929 return false; 930 } 931 932 psString query = NULL; 933 psStringAppend(&query, "UPDATE newExp SET state = '%s'", new_state); 934 935 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 936 psStringAppend(&query, "\nWHERE %s", whereClause); 937 938 psFree(whereClause); 939 psFree(where); 940 941 if (!p_psDBRunQuery(config->dbh, query)) { 942 psError(PS_ERR_UNKNOWN, false, "database error"); 943 psFree(query); 944 return false; 945 } 946 psFree(query); 947 948 return true; 949 } 950 907 951 908 952 #if 0
Note:
See TracChangeset
for help on using the changeset viewer.
