Changeset 27391 for trunk/ippTools/src
- Timestamp:
- Mar 22, 2010, 1:58:02 PM (16 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 11 edited
-
addtool.c (modified) (2 diffs)
-
camtool.c (modified) (1 diff)
-
chiptool.c (modified) (4 diffs)
-
chiptool.h (modified) (1 diff)
-
chiptoolConfig.c (modified) (2 diffs)
-
difftool.c (modified) (2 diffs)
-
faketool.c (modified) (1 diff)
-
pxtools.c (modified) (4 diffs)
-
pxtools.h (modified) (1 diff)
-
stacktool.c (modified) (1 diff)
-
warptool.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/addtool.c
r26981 r27391 290 290 291 291 // pxUpdateRun gets parameters from config->args and runs the update query 292 bool result = pxUpdateRun(config, where, &query, "addRun", false); 292 bool result = pxUpdateRun(config, where, &query, "addRun", "add_id", 293 "addProcessedExp", false); 293 294 294 295 psFree(query); … … 296 297 297 298 return result; 298 299 300 #ifdef notdef301 PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false);302 PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false);303 304 if ((!state) && (!label)) {305 psError(PXTOOLS_ERR_CONFIG, false, "parameters are required");306 psFree(where);307 return false;308 }309 310 if (state) {311 // set addRun.state to state312 if (!pxaddRunSetStateByQuery(config, where, state)) {313 psFree(where);314 return false;315 }316 }317 318 if (label) {319 // set addRun.label to label320 if (!pxaddRunSetLabelByQuery(config, where, label)) {321 psFree(where);322 return false;323 }324 }325 326 psFree(where);327 328 return true;329 #endif330 299 } 331 300 -
trunk/ippTools/src/camtool.c
r27300 r27391 267 267 268 268 // pxUpdateRun gets parameters from config->args and updates 269 bool result = pxUpdateRun(config, where, &query, "camRun", true);269 bool result = pxUpdateRun(config, where, &query, "camRun", "cam_id", "camProcessedExp", true); 270 270 if (!result) { 271 271 psError(psErrorCodeLast(), false, "pxUpdateRun failed"); -
trunk/ippTools/src/chiptool.c
r27195 r27391 59 59 static bool importrunMode(pxConfig *config); 60 60 static bool runstateMode(pxConfig *config); 61 static bool setimfiletoupdateMode(pxConfig *config); 61 62 62 63 # define MODECASE(caseName, func) \ … … 101 102 MODECASE(CHIPTOOL_MODE_IMPORTRUN, importrunMode); 102 103 MODECASE(CHIPTOOL_MODE_RUNSTATE, runstateMode); 104 MODECASE(CHIPTOOL_MODE_SETIMFILETOUPDATE, setimfiletoupdateMode); 103 105 default: 104 106 psAbort("invalid option (this should not happen)"); … … 428 430 return false; 429 431 } 430 psString query = psStringCopy("UPDATE chipRun JOIN rawExp USING(exp_id) ");432 psString query = psStringCopy("UPDATE chipRun JOIN rawExp USING(exp_id) -- join hook %s\n"); 431 433 432 434 // pxUpdateRun gets parameters from config->args and updates 433 bool result = pxUpdateRun(config, where, &query, "chipRun", true);435 bool result = pxUpdateRun(config, where, &query, "chipRun", "chip_id", "chipProcessedImfile", true); 434 436 if (!result) { 435 437 psError(psErrorCodeLast(), false, "pxUpdateRun failed"); … … 1720 1722 return true; 1721 1723 } 1724 1725 // a very specfic function to queue a cleaned chipProcessedImfile to be updated 1726 static bool setimfiletoupdateMode(pxConfig *config) 1727 { 1728 PS_ASSERT_PTR_NON_NULL(config, NULL); 1729 1730 PXOPT_LOOKUP_S64(chip_id, config->args, "-chip_id", true, false); 1731 PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", false, false); 1732 PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false); 1733 1734 psString query = pxDataGet("chiptool_setimfiletoupdate.sql"); 1735 if (!query) { 1736 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1737 return false; 1738 } 1739 1740 psString setHook = psStringCopy(""); 1741 if (label) { 1742 psStringAppend(&setHook, "\n , chipRun.label = '%s'", label); 1743 } 1744 1745 if (class_id) { 1746 psStringAppend(&query, " AND (chipProcessedImfile.class_id = '%s')", class_id); 1747 } 1748 1749 if (!p_psDBRunQueryF(config->dbh, query, setHook, chip_id)) { 1750 psError(PS_ERR_UNKNOWN, false, "database error"); 1751 return false; 1752 } 1753 1754 psFree(setHook); 1755 psFree(query); 1756 1757 return true; 1758 } -
trunk/ippTools/src/chiptool.h
r27192 r27391 33 33 CHIPTOOL_MODE_REVERTPROCESSEDIMFILE, 34 34 CHIPTOOL_MODE_UPDATEPROCESSEDIMFILE, 35 CHIPTOOL_MODE_SETIMFILETOUPDATE, 35 36 CHIPTOOL_MODE_ADVANCEEXP, 36 37 CHIPTOOL_MODE_BLOCK, -
trunk/ippTools/src/chiptoolConfig.c
r27195 r27391 97 97 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_dist_group", 0, "set dist group", NULL); 98 98 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-set_note", 0, "set note", NULL); 99 100 // -setimfiletoupdate 101 psMetadata *setimfiletoupdateArgs = psMetadataAlloc(); 102 psMetadataAddS64(setimfiletoupdateArgs, PS_LIST_TAIL, "-chip_id", 0, "search by chip ID (required)", 0); 103 psMetadataAddStr(setimfiletoupdateArgs, PS_LIST_TAIL, "-class_id", 0, "search by class_id (required)", NULL); 104 psMetadataAddStr(setimfiletoupdateArgs, PS_LIST_TAIL, "-set_label", 0,"new value for label", NULL); 99 105 100 106 // -pendingimfile … … 315 321 PXOPT_ADD_MODE("-definecopy", "create copy runs", CHIPTOOL_MODE_DEFINECOPY, definecopyArgs); 316 322 PXOPT_ADD_MODE("-updaterun", "change chip run properties", CHIPTOOL_MODE_UPDATERUN, updaterunArgs); 323 PXOPT_ADD_MODE("-setimfiletoupdate", "set imfile state to update", CHIPTOOL_MODE_SETIMFILETOUPDATE, setimfiletoupdateArgs); 317 324 PXOPT_ADD_MODE("-pendingimfile", "show pending imfiles", CHIPTOOL_MODE_PENDINGIMFILE, pendingimfileArgs); 318 325 PXOPT_ADD_MODE("-addprocessedimfile", "add a processed imfile", CHIPTOOL_MODE_ADDPROCESSEDIMFILE, addprocessedimfileArgs); -
trunk/ippTools/src/difftool.c
r27210 r27391 204 204 205 205 // pxUpdateRun gets parameters from config->args and updates 206 bool result = pxUpdateRun(config, where, &query, "diffRun", true);206 bool result = pxUpdateRun(config, where, &query, "diffRun", "diff_id", "diffSkyfile", true); 207 207 208 208 psFree(query); … … 210 210 211 211 return result; 212 213 #ifdef notdef214 // required options215 PXOPT_LOOKUP_S64(diff_id, config->args, "-diff_id", false, false);216 PXOPT_LOOKUP_STR(state, config->args, "-state", true, false);217 PXOPT_LOOKUP_STR(label, config->args, "-label", false, false);218 219 // Copy of my hacky work around from stacktool.c220 if ((state)&&(diff_id)) {221 // set detRun.state to state222 return setdiffRunState(config, diff_id, state, false);223 }224 225 if ((state)&&(label)) {226 return setdiffRunStateByLabel(config, label, state);227 }228 229 psError(PS_ERR_UNKNOWN, false, "Required options not found.");230 231 return false;232 #endif233 212 } 234 213 -
trunk/ippTools/src/faketool.c
r27210 r27391 348 348 349 349 // pxUpdateRun gets parameters from config->args and updates 350 bool result = pxUpdateRun(config, where, &query, "fakeRun", true);350 bool result = pxUpdateRun(config, where, &query, "fakeRun", "fake_id", "fakeProcessedImfile", true); 351 351 if (!result) { 352 352 psError(psErrorCodeLast(), false, "pxUpdateRun failed"); -
trunk/ippTools/src/pxtools.c
r27258 r27391 110 110 111 111 // shared code for updating the various strings for a Run 112 bool pxUpdateRun(pxConfig *config, psMetadata *where, psString *pQuery, psString table, bool has_dist_group)112 bool pxUpdateRun(pxConfig *config, psMetadata *where, psString *pQuery, psString runTable, psString idColumn, psString fileTable, bool has_dist_group) 113 113 { 114 114 PS_ASSERT_PTR_NON_NULL(config, false); … … 116 116 PS_ASSERT_PTR_NON_NULL(pQuery, false); 117 117 PS_ASSERT_PTR_NON_NULL(*pQuery, false); 118 PS_ASSERT_PTR_NON_NULL(runTable, false); 119 PS_ASSERT_PTR_NON_NULL(idColumn, false); 120 PS_ASSERT_PTR_NON_NULL(fileTable, false); 118 121 119 122 // make sure that -state is not the only selection parameter … … 158 161 } while (0) 159 162 160 addColumn( table, state);161 addColumn( table, data_group);163 addColumn(runTable, state); 164 addColumn(runTable, data_group); 162 165 if (has_dist_group) { 163 addColumn(table, dist_group); 164 } 165 addColumn(table, note); 166 addColumn(table, label); 166 addColumn(runTable, dist_group); 167 } 168 addColumn(runTable, note); 169 addColumn(runTable, label); 170 171 psString joinHook = psStringCopy(""); 172 psString fileWhere = NULL; 173 if (state && !strcmp(state, "update")) { 174 psStringAppend(&joinHook, "\n JOIN %s USING(%s)", fileTable, idColumn); 175 psStringAppend(pQuery, ", %s.data_state = 'update'", fileTable); 176 psStringAppend(&fileWhere, "AND %s.data_state = 'cleaned'", fileTable); 177 } 167 178 168 179 psString whereClause = psDBGenerateWhereSQL(where, NULL); 169 180 psStringAppend(pQuery, " %s", whereClause); 170 181 psFree(whereClause); 182 if (fileWhere) { 183 psStringAppend(pQuery, fileWhere); 184 } 171 185 172 186 bool mdok; // Status of MD lookup … … 176 190 } 177 191 178 if (!p_psDBRunQuery (config->dbh, *pQuery)) {192 if (!p_psDBRunQueryF(config->dbh, *pQuery, joinHook)) { 179 193 psError(PS_ERR_UNKNOWN, false, "database error"); 180 194 return false; -
trunk/ippTools/src/pxtools.h
r25851 r27391 65 65 bool pxGetOptions(FILE *stream, int argc, char **argv, pxConfig *config, psMetadata *modes, psMetadata *argSets); 66 66 67 bool pxUpdateRun(pxConfig *config, psMetadata *where, psString *pQuery, psString table, bool has_dist_group);67 bool pxUpdateRun(pxConfig *config, psMetadata *where, psString *pQuery, psString runTable, psString idColumn, psString fileTable, bool has_dist_group); 68 68 69 69 #define PXOPT_ADD_MODE(option, comment, modeval, argset) \ -
trunk/ippTools/src/stacktool.c
r27120 r27391 612 612 613 613 // pxUpdateRun gets parameters from config->args and updates 614 bool result = pxUpdateRun(config, where, &query, "stackRun", true);614 bool result = pxUpdateRun(config, where, &query, "stackRun", "stack_id", "stackSumSkyfile", true); 615 615 616 616 psFree(query); -
trunk/ippTools/src/warptool.c
r27389 r27391 402 402 } 403 403 404 psString query = psStringCopy("UPDATE warpRun JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id)");404 psString query = psStringCopy("UPDATE warpRun JOIN warpSkyfile USING(warp_id) JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id)"); 405 405 406 406 // pxUpdateRun gets parameters from config->args and updates 407 bool result = pxUpdateRun(config, where, &query, "warpRun", true);407 bool result = pxUpdateRun(config, where, &query, "warpRun", "warp_id", "warpSkyfile", true); 408 408 409 409 psFree(query); … … 907 907 } 908 908 909 psString whereStr = psStringCopy(""); 909 910 if (psListLength(where->list)) { 910 911 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 911 psStringAppend(& query, "AND %s", whereClause);912 psStringAppend(&whereStr, "\n AND %s", whereClause); 912 913 psFree(whereClause); 913 914 } … … 921 922 } 922 923 923 if (!p_psDBRunQuery (config->dbh, query)) {924 if (!p_psDBRunQueryF(config->dbh, query, whereStr, whereStr)) { 924 925 psError(PS_ERR_UNKNOWN, false, "database error"); 925 926 psFree(query); 926 927 return false; 927 928 } 929 psFree(whereStr); 928 930 psFree(query); 929 931
Note:
See TracChangeset
for help on using the changeset viewer.
