- Timestamp:
- Apr 2, 2013, 3:01:21 PM (13 years ago)
- Location:
- branches/eam_branches/ipp-20130307
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ippTools/src (modified) (1 prop)
-
ippTools/src/releasetool.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130307
- Property svn:mergeinfo changed
/trunk (added) merged: 35269-35270,35277,35294-35295,35297-35302,35304-35308,35311,35315,35317-35318,35325,35328-35332,35334-35335,35337
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20130307/ippTools/src
- Property svn:mergeinfo changed
/trunk/ippTools/src (added) merged: 35295,35297-35298,35304,35308,35318
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20130307/ippTools/src/releasetool.c
r35230 r35350 1270 1270 } 1271 1271 if (!psArrayLength(exposures)) { 1272 fprintf(stderr, "no exposures found for lap_id %" PRId64 "\n", lap_id); 1273 #ifdef notdef 1274 continue; 1272 1275 psFree(now); 1273 1276 psFree(output); … … 1278 1281 } 1279 1282 return false; 1283 #endif 1280 1284 } 1281 1285 … … 1301 1305 psFree(exposures); 1302 1306 1303 // setstate of relGroup to 'new'1307 // update the state of relGroup to 'new' 1304 1308 if (!p_psDBRunQueryF(config->dbh, "UPDATE relGroup set state = 'new' WHERE group_id = %d", group_id)) { 1305 1309 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1325 1329 static bool updaterelgroupMode(pxConfig *config) 1326 1330 { 1327 psError(PS_ERR_UNKNOWN, true, "not yet implemented"); 1328 return false; 1331 PS_ASSERT_PTR_NON_NULL(config, false); 1332 1333 PXOPT_LOOKUP_S32(group_id, config->args, "-group_id", true, false); 1334 1335 PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false); 1336 PXOPT_LOOKUP_STR(exp_list_path, config->args, "-set_exp_list_path", false, false); 1337 PXOPT_LOOKUP_STR(new_label, config->args, "-set_label", false, false); 1338 PXOPT_LOOKUP_S16(fault, config->args, "-set_fault", false, false); 1339 PXOPT_LOOKUP_BOOL(clearfault, config->args, "-clearfault", false); 1340 1341 if (!state && !exp_list_path && !new_label && !fault && !clearfault) { 1342 psError(PXTOOLS_ERR_CONFIG, true, "must set at least one column\n"); 1343 return false; 1344 } 1345 1346 if (fault && clearfault) { 1347 psError(PXTOOLS_ERR_CONFIG, true, "cannot set and clear fault at same time\n"); 1348 return false; 1349 } 1350 1351 psMetadata *where = psMetadataAlloc(); 1352 1353 PXOPT_COPY_S64(config->args, where, "-group_id", "relGroup.group_id", "=="); 1354 // XXX TODO if label is enabled (for changing label or state for a block) we should 1355 // disallow setting some parameters such as exp_list_path 1356 // PXOPT_COPY_S64(config->args, where, "-label", "relGroup.label", "=="); 1357 // make sure that we have enough parameters to identify the relGroup to change 1358 if (!psListLength(where->list)){ 1359 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required\n"); 1360 psFree(where); 1361 return false; 1362 } 1363 1364 psString sep = ""; 1365 psString comma = ", "; 1366 psString query = psStringCopy("UPDATE relGroup SET"); 1367 if (state) { 1368 psStringAppend(&query, "%s relGroup.state = '%s'", sep, state); 1369 sep = comma; 1370 } 1371 if (exp_list_path) { 1372 psStringAppend(&query, "%s relGroup.exp_list_path = '%s'", sep, exp_list_path); 1373 sep = comma; 1374 } 1375 if (new_label) { 1376 psStringAppend(&query, "%s relGroup.label = '%s'", sep, new_label); 1377 sep = comma; 1378 } 1379 if (fault) { 1380 psStringAppend(&query, "%s relGroup.fault = %d", sep, fault); 1381 sep = comma; 1382 } 1383 if (clearfault) { 1384 psStringAppend(&query, "%s relGroup.fault = 0", sep); 1385 sep = comma; 1386 } 1387 1388 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1389 psStringAppend(&query, " WHERE %s", whereClause); 1390 psFree(whereClause); 1391 1392 if (!p_psDBRunQuery(config->dbh, query)) { 1393 psError(PS_ERR_UNKNOWN, false, "database error"); 1394 psFree(query); 1395 return false; 1396 } 1397 1398 psU64 affected = psDBAffectedRows(config->dbh); 1399 psLogMsg("releasetool", PS_LOG_INFO, "Updated %" PRIu64 " ippReleases", affected); 1400 1401 1402 psFree(query); 1403 1404 return true; 1329 1405 } 1330 1406
Note:
See TracChangeset
for help on using the changeset viewer.
