Changeset 11810 for trunk/ippTools/src/warptool.c
- Timestamp:
- Feb 14, 2007, 4:06:30 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/warptool.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/warptool.c
r11791 r11810 43 43 static bool warpedMode(pxConfig *config); 44 44 45 #if 046 static bool tostackedimfileMode(pxConfig *config);47 //static bool addstackedimfileMode(pxConfig *config);48 static bool stackedimfileMode(pxConfig *config);49 static bool todiffimfileMode(pxConfig *config);50 //static bool adddiffimfileMode(pxConfig *config);51 static bool diffimfileMode(pxConfig *config);52 #endif53 54 45 static bool parseAndInsertSkyCellMap(pxConfig *config, const char *mapfile); 55 46 static bool setp4RunState(pxConfig *config, const char *p4_id, const char *state); … … 81 72 MODECASE(P4TOOL_MODE_ADDWARPED, addwarpedMode); 82 73 MODECASE(P4TOOL_MODE_WARPED, warpedMode); 83 84 #if 085 MODECASE(P4TOOL_MODE_ADDSCFILE, addscfileMode);86 MODECASE(P4TOOL_MODE_SCFILE, scfileMode);87 MODECASE(P4TOOL_MODE_TOSTACKEDIMFILE, tostackedimfileMode);88 // MODECASE(P4TOOL_MODE_ADDSTACKEDIMFILE, addstackedimfileMode);89 MODECASE(P4TOOL_MODE_STACKEDIMFILE, stackedimfileMode);90 MODECASE(P4TOOL_MODE_TODIFFIMFILE, todiffimfileMode);91 // MODECASE(P4TOOL_MODE_ADDDIFFIMFILE, adddiffimfileMode);92 MODECASE(P4TOOL_MODE_DIFFIMFILE, diffimfileMode);93 #endif94 74 default: 95 75 psAbort("invalid option (this should not happen)"); … … 944 924 } 945 925 926 946 927 static bool warpedMode(pxConfig *config) 947 928 { … … 1030 1011 } 1031 1012 1032 #if 01033 static bool tostackedimfileMode(pxConfig *config)1034 {1035 PS_ASSERT_PTR_NON_NULL(config, NULL);1036 1037 psString query = psStringCopy(1038 " SELECT DISTINCT"1039 " p4WarpedImfile.*,"1040 " p4Run.workdir"1041 " FROM p4Run"1042 " JOIN p4WarpedImfile"1043 " USING(p4_id)"1044 " LEFT JOIN p4StackedImfile"1045 " USING(p4_id, class_id)"1046 " WHERE"1047 " p4Run.state = 'run'"1048 " AND p4StackedImfile.p4_id IS NULL"1049 " AND p4Stackedmfile.class_id IS NULL"1050 );1051 1052 if (config->where) {1053 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4WarpedImfile");1054 psStringAppend(&query, " AND %s", whereClause);1055 psFree(whereClause);1056 }1057 1058 if (!p_psDBRunQuery(config->dbh, query)) {1059 psError(PS_ERR_UNKNOWN, false, "database error");1060 psFree(query);1061 return false;1062 }1063 psFree(query);1064 1065 psArray *output = p_psDBFetchResult(config->dbh);1066 if (!output) {1067 psError(PS_ERR_UNKNOWN, false, "database error");1068 return false;1069 }1070 if (!psArrayLength(output)) {1071 psError(PS_ERR_UNKNOWN, false, "no p4WarpedImfile rows found");1072 psFree(output);1073 return true;1074 }1075 1076 bool simple = false;1077 {1078 bool status = false;1079 simple = psMetadataLookupBool(&status, config->args, "-simple");1080 if (!status) {1081 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");1082 return false;1083 }1084 }1085 1086 // negative simple so the default is true1087 if (!ippdbPrintMetadatas(stdout, output, "p4WarpedImfile", !simple)) {1088 psError(PS_ERR_UNKNOWN, false, "failed to print array");1089 psFree(output);1090 return false;1091 }1092 1093 psFree(output);1094 1095 return true;1096 }1097 1098 static bool addstackedimfileMode(pxConfig *config)1099 {1100 PS_ASSERT_PTR_NON_NULL(config, NULL);1101 1102 bool status = false;1103 psString p4_id = psMetadataLookupStr(&status, config->args, "-p4_id");1104 if (!status) {1105 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p4_id");1106 return false;1107 }1108 if (!p4_id) {1109 psError(PS_ERR_UNKNOWN, true, "-p4_id is required");1110 return false;1111 }1112 1113 psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");1114 if (!status) {1115 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id");1116 return false;1117 }1118 if (!class_id) {1119 psError(PS_ERR_UNKNOWN, true, "-class_id is required");1120 return false;1121 }1122 1123 psString uri = psMetadataLookupStr(&status, config->args, "-uri");1124 if (!status) {1125 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -uri");1126 return false;1127 }1128 if (!uri) {1129 psError(PS_ERR_UNKNOWN, true, "-uri is required");1130 return false;1131 }1132 1133 // optional1134 psString b1_uri = psMetadataLookupStr(&status, config->args, "-b1_uri");1135 if (!status) {1136 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -b1_uri");1137 return false;1138 }1139 1140 psString b2_uri = psMetadataLookupStr(&status, config->args, "-b2_uri");1141 if (!status) {1142 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -b2_uri");1143 return false;1144 }1145 1146 // XXX need to validate that this coresponds to an p4WarpedImfile1147 if (!p4StackedImfileInsert(config->dbh,1148 (psS32)atoi(p4_id),1149 class_id,1150 uri,1151 b1_uri,1152 b2_uri1153 )) {1154 psError(PS_ERR_UNKNOWN, false, "database error");1155 return false;1156 }1157 1158 return true;1159 }1160 1161 static bool stackedimfileMode(pxConfig *config)1162 {1163 PS_ASSERT_PTR_NON_NULL(config, NULL);1164 1165 psString query = psStringCopy(1166 " SELECT DISTINCT"1167 " p4StackedImfile.*"1168 " FROM p4Run"1169 " JOIN p4StackedImfile"1170 " USING(p4_id)"1171 " WHERE"1172 " p4Run.state = 'run'"1173 );1174 1175 if (config->where) {1176 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4StackedImfile");1177 psStringAppend(&query, " AND %s", whereClause);1178 psFree(whereClause);1179 }1180 1181 if (!p_psDBRunQuery(config->dbh, query)) {1182 psError(PS_ERR_UNKNOWN, false, "database error");1183 psFree(query);1184 return false;1185 }1186 psFree(query);1187 1188 psArray *output = p_psDBFetchResult(config->dbh);1189 if (!output) {1190 psError(PS_ERR_UNKNOWN, false, "database error");1191 return false;1192 }1193 if (!psArrayLength(output)) {1194 psError(PS_ERR_UNKNOWN, false, "no p4StackedImfile rows found");1195 psFree(output);1196 return true;1197 }1198 1199 bool simple = false;1200 {1201 bool status = false;1202 simple = psMetadataLookupBool(&status, config->args, "-simple");1203 if (!status) {1204 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");1205 return false;1206 }1207 }1208 1209 // negative simple so the default is true1210 if (!ippdbPrintMetadatas(stdout, output, "p4StackedImfile", !simple)) {1211 psError(PS_ERR_UNKNOWN, false, "failed to print array");1212 psFree(output);1213 return false;1214 }1215 1216 psFree(output);1217 1218 return true;1219 }1220 1221 static bool todiffimfileMode(pxConfig *config)1222 {1223 PS_ASSERT_PTR_NON_NULL(config, NULL);1224 1225 psString query = psStringCopy(1226 " SELECT DISTINCT"1227 " p4StackedImfile.*,"1228 " p4WarpedImfile.uri as warped_uri,"1229 " p4Run.workdir"1230 " FROM p4Run"1231 " JOIN p4StackedImfile"1232 " USING(p4_id)"1233 " JOIN p4WarpedImfile"1234 " USING(p4_id, class_id)"1235 " LEFT JOIN p4DiffImfile"1236 " ON p4WarpedImfile.p4_id = p4DiffImfile.p4_id"1237 " AND p4WarpedImfile.exp_tag = p4DiffImfile.exp_tag"1238 " AND p4WarpedImfile.p3_version = p4DiffImfile.p3_version"1239 " AND p4WarpedImfile.class_id = p4DiffImfile.class_id"1240 " WHERE"1241 " p4Run.state = 'run'"1242 " AND p4DiffImfile.p4_id IS NULL"1243 " AND p4DiffImfile.exp_tag IS NULL"1244 " AND p4DiffImfile.p3_version IS NULL"1245 " AND p4DiffImfile.class_id IS NULL"1246 );1247 1248 if (config->where) {1249 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4StackedImfile");1250 psStringAppend(&query, " AND %s", whereClause);1251 psFree(whereClause);1252 }1253 1254 if (!p_psDBRunQuery(config->dbh, query)) {1255 psError(PS_ERR_UNKNOWN, false, "database error");1256 psFree(query);1257 return false;1258 }1259 psFree(query);1260 1261 psArray *output = p_psDBFetchResult(config->dbh);1262 if (!output) {1263 psError(PS_ERR_UNKNOWN, false, "database error");1264 return false;1265 }1266 if (!psArrayLength(output)) {1267 psError(PS_ERR_UNKNOWN, false, "no p4StackedImfile rows found");1268 psFree(output);1269 return true;1270 }1271 1272 bool simple = false;1273 {1274 bool status = false;1275 simple = psMetadataLookupBool(&status, config->args, "-simple");1276 if (!status) {1277 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");1278 return false;1279 }1280 }1281 1282 // negative simple so the default is true1283 if (!ippdbPrintMetadatas(stdout, output, "p4StackedImfile", !simple)) {1284 psError(PS_ERR_UNKNOWN, false, "failed to print array");1285 psFree(output);1286 return false;1287 }1288 1289 psFree(output);1290 1291 return true;1292 }1293 1294 static bool adddiffimfileMode(pxConfig *config)1295 {1296 PS_ASSERT_PTR_NON_NULL(config, NULL);1297 1298 bool status = false;1299 psString p4_id = psMetadataLookupStr(&status, config->args, "-p4_id");1300 if (!status) {1301 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p4_id");1302 return false;1303 }1304 if (!p4_id) {1305 psError(PS_ERR_UNKNOWN, true, "-p4_id is required");1306 return false;1307 }1308 1309 psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");1310 if (!status) {1311 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");1312 return false;1313 }1314 if (!exp_tag) {1315 psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");1316 return false;1317 }1318 1319 psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");1320 if (!status) {1321 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id");1322 return false;1323 }1324 if (!class_id) {1325 psError(PS_ERR_UNKNOWN, true, "-class_id is required");1326 return false;1327 }1328 1329 psString uri = psMetadataLookupStr(&status, config->args, "-uri");1330 if (!status) {1331 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -uri");1332 return false;1333 }1334 if (!uri) {1335 psError(PS_ERR_UNKNOWN, true, "-uri is required");1336 return false;1337 }1338 1339 // defaults to 01340 psS32 p3_version = psMetadataLookupS32(&status, config->args, "-p3_version");1341 if (!status) {1342 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p3_version");1343 return false;1344 }1345 1346 // optional1347 psString b1_uri = psMetadataLookupStr(&status, config->args, "-b1_uri");1348 if (!status) {1349 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -b1_uri");1350 return false;1351 }1352 1353 psString b2_uri = psMetadataLookupStr(&status, config->args, "-b2_uri");1354 if (!status) {1355 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -b2_uri");1356 return false;1357 }1358 1359 // XXX need to validate that this coresponds to an p4InputImfile1360 if (!p4DiffImfileInsert(config->dbh,1361 (psS32)atoi(p4_id),1362 exp_tag,1363 p3_version,1364 class_id,1365 uri,1366 b1_uri,1367 b2_uri1368 )) {1369 psError(PS_ERR_UNKNOWN, false, "database error");1370 return false;1371 }1372 1373 return true;1374 }1375 1376 static bool diffimfileMode(pxConfig *config)1377 {1378 PS_ASSERT_PTR_NON_NULL(config, NULL);1379 1380 psString query = psStringCopy(1381 " SELECT DISTINCT"1382 " p4DiffImfile.*"1383 " FROM p4Run"1384 " JOIN p4DiffImfile"1385 " USING(p4_id)"1386 " WHERE"1387 " p4Run.state = 'run'"1388 );1389 1390 if (config->where) {1391 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4DiffImfile");1392 psStringAppend(&query, " AND %s", whereClause);1393 psFree(whereClause);1394 }1395 1396 if (!p_psDBRunQuery(config->dbh, query)) {1397 psError(PS_ERR_UNKNOWN, false, "database error");1398 psFree(query);1399 return false;1400 }1401 psFree(query);1402 1403 psArray *output = p_psDBFetchResult(config->dbh);1404 if (!output) {1405 psError(PS_ERR_UNKNOWN, false, "database error");1406 return false;1407 }1408 if (!psArrayLength(output)) {1409 psError(PS_ERR_UNKNOWN, false, "no p4DiffImfile rows found");1410 psFree(output);1411 return true;1412 }1413 1414 bool simple = false;1415 {1416 bool status = false;1417 simple = psMetadataLookupBool(&status, config->args, "-simple");1418 if (!status) {1419 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");1420 return false;1421 }1422 }1423 1424 // negative simple so the default is true1425 if (!ippdbPrintMetadatas(stdout, output, "p4DiffImfile", !simple)) {1426 psError(PS_ERR_UNKNOWN, false, "failed to print array");1427 psFree(output);1428 return false;1429 }1430 1431 psFree(output);1432 1433 return true;1434 }1435 #endif1436 1013 1437 1014 static bool setp4RunState(pxConfig *config, const char *p4_id, const char *state) … … 1461 1038 return true; 1462 1039 } 1040 1463 1041 1464 1042 static bool isValidMode(pxConfig *config, const char *mode)
Note:
See TracChangeset
for help on using the changeset viewer.
