- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ippTools/src (modified) (1 prop)
-
ippTools/src/pubtool.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/ippTools/src
- Property svn:ignore
-
old new 1 *.la 2 *.lo 1 3 .deps 2 4 .gdb_history … … 4 6 Makefile 5 7 Makefile.in 8 addtool 9 caltool 10 camtool 11 chiptool 6 12 config.h 7 13 config.h.in 8 stamp-h1 9 *.la 10 *.lo 14 detselect 15 dettool 16 difftool 17 disttool 18 dqstatstool 19 faketool 20 flatcorr 21 guidetool 22 magicdstool 23 magictool 24 pstamptool 25 pubtool 26 pxadmin 27 pxdata.c 28 pxinject 11 29 pxtoolsErrorCodes.c 12 30 pxtoolsErrorCodes.h 13 pxadmin14 pxinject15 pztool16 31 pzgetexp 17 32 pzgetimfiles 33 pztool 34 receivetool 18 35 regtool 19 guidetool 20 chiptool 21 camtool 36 stacktool 37 stamp-h1 22 38 warptool 23 difftool24 stacktool25 faketool26 dettool27 detselect28 pxdata.c29 magictool30 magicdstool31 caltool32 flatcorr33 pstamptool34 disttool35 receivetool36 37 pubtool
-
- Property svn:ignore
-
branches/simtest_nebulous_branches/ippTools/src/pubtool.c
r24512 r27840 32 32 33 33 static bool defineclientMode(pxConfig *config); 34 static bool updateclientMode(pxConfig *config); 34 35 static bool definerunMode(pxConfig *config); 35 36 static bool pendingMode(pxConfig *config); … … 57 58 switch (config->mode) { 58 59 MODECASE(PUBTOOL_MODE_DEFINECLIENT, defineclientMode); 60 MODECASE(PUBTOOL_MODE_UPDATECLIENT, updateclientMode); 59 61 MODECASE(PUBTOOL_MODE_DEFINERUN, definerunMode); 60 62 MODECASE(PUBTOOL_MODE_PENDING, pendingMode); … … 93 95 // optional 94 96 PXOPT_LOOKUP_STR(comment, config->args, "-comment", false, false); 95 96 if (!publishClientInsert(config->dbh, 0, product, stage, workdir, comment)) { 97 psError(PS_ERR_UNKNOWN, false, "Database error"); 98 return false; 99 } 97 PXOPT_LOOKUP_BOOL(unmagicked, config->args, "-unmagicked", false); 98 99 if (!publishClientInsert(config->dbh, 0, 0, product, stage, !unmagicked, workdir, comment)) { 100 psError(PS_ERR_UNKNOWN, false, "Database error"); 101 return false; 102 } 103 104 return true; 105 } 106 107 static bool updateclientMode(pxConfig *config) 108 { 109 PS_ASSERT_PTR_NON_NULL(config, false); 110 111 psMetadata *where = psMetadataAlloc(); // WHERE conditions 112 PXOPT_COPY_S64(config->args, where, "-client_id", "client_id", "=="); 113 PXOPT_COPY_STR(config->args, where, "-product", "product", "=="); 114 PXOPT_COPY_STR(config->args, where, "-stage", "stage", "=="); 115 PXOPT_COPY_STR(config->args, where, "-comment", "comment", "LIKE"); 116 117 PXOPT_LOOKUP_BOOL(active, config->args, "-active", false); 118 PXOPT_LOOKUP_BOOL(inactive, config->args, "-inactive", false); 119 120 if ((!active && !inactive) || (active && inactive)) { 121 psError(PS_ERR_UNKNOWN, false, "Must specify one, and only one, of -active and -inactive."); 122 psFree(where); 123 return false; 124 } 125 126 psString query = NULL; // Query to run 127 psStringAppend(&query, "UPDATE publishClient SET active = %d", active ? 1 : 0); 128 129 if (psListLength(where->list)) { 130 psString clause = psDBGenerateWhereConditionSQL(where, NULL); 131 psStringAppend(&query, "\n WHERE %s", clause); 132 psFree(clause); 133 } 134 psFree(where); 135 136 if (!p_psDBRunQuery(config->dbh, query)) { 137 psError(PS_ERR_UNKNOWN, false, "Database error"); 138 psFree(query); 139 return false; 140 } 141 psFree(query); 142 143 long numUpdated = psDBAffectedRows(config->dbh); 144 psLogMsg("pubtool", PS_LOG_INFO, "%ld rows updated.", numUpdated); 100 145 101 146 return true; … … 112 157 // optional 113 158 PXOPT_COPY_S64(config->args, where, "-client_id", "client_id", "=="); 114 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); 115 116 PXOPT_LOOKUP_STR(label, config->args, "-label", false, false); 159 pxAddLabelSearchArgs(config, where, "-label", "label", "=="); // define using newExp label 117 160 118 161 psString query = pxDataGet("pubtool_definerun.sql"); // Query to run 119 162 if (!query) { 120 psError(PXTOOLS_ERR_ DATA, false, "Failed to retreive SQL statement");163 psError(PXTOOLS_ERR_SYS, false, "Failed to retreive SQL statement"); 121 164 psFree(where); 122 165 return false; … … 167 210 psS64 client = psMetadataLookupS64(NULL, row, "client_id"); // Client identifier 168 211 psS64 stage = psMetadataLookupS64(NULL, row, "stage_id"); // Stage identifier 212 char *label = psMetadataLookupStr(NULL, row, "src_label"); // label from correct source 169 213 170 214 if (!publishRunInsert(config->dbh, 0, client, stage, label, "new")) { … … 205 249 psString query = pxDataGet("pubtool_pending.sql"); 206 250 if (!query) { 207 psError(PXTOOLS_ERR_ DATA, false, "Failed to retreive SQL statement");251 psError(PXTOOLS_ERR_SYS, false, "Failed to retreive SQL statement"); 208 252 psFree(where); 209 253 return false; … … 259 303 // required 260 304 PXOPT_LOOKUP_S64(pub_id, config->args, "-pub_id", true, false); 261 PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", true, false);305 PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", true, false); 262 306 263 307 // optional 308 PXOPT_LOOKUP_STR(hostname, config->args, "-hostname", false, false); 309 PXOPT_LOOKUP_F32(dtime_script, config->args, "-dtime_script", false, false); 264 310 PXOPT_LOOKUP_S32(fault, config->args, "-fault", false, false); 265 311 … … 269 315 } 270 316 271 if (!publishDoneInsert(config->dbh, pub_id, path_base, fault)) {317 if (!publishDoneInsert(config->dbh, pub_id, path_base, hostname, dtime_script, fault)) { 272 318 psError(PS_ERR_UNKNOWN, false, "Unable to add file"); 273 319 if (!psDBRollback(config->dbh)) { … … 309 355 PXOPT_COPY_STR(config->args, where, "-client_id", "publishClient.client_id", "=="); 310 356 PXOPT_COPY_STR(config->args, where, "-comment", "publishClient.comment", "LIKE"); 311 PXOPT_COPY_STR(config->args, where, "-label", "publishRun.label", "==");357 pxAddLabelSearchArgs(config, where, "-label", "publishRun.label", "=="); 312 358 313 359 psString query = pxDataGet("pubtool_revert.sql"); 314 360 if (!query) { 315 psError(PXTOOLS_ERR_ DATA, false, "Failed to retreive SQL statement");361 psError(PXTOOLS_ERR_SYS, false, "Failed to retreive SQL statement"); 316 362 psFree(where); 317 363 return false; … … 332 378 psFree(query); 333 379 334 return true; 335 } 336 380 psLogMsg("pubtool", PS_LOG_INFO, "Deleted %" PRIu64 " rows", psDBAffectedRows(config->dbh)); 381 382 return true; 383 } 384
Note:
See TracChangeset
for help on using the changeset viewer.
