Changeset 11765
- Timestamp:
- Feb 12, 2007, 6:03:36 PM (19 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 2 edited
-
warptool.c (modified) (2 diffs)
-
warptoolConfig.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/warptool.c
r11763 r11765 291 291 static bool expMode(pxConfig *config) 292 292 { 293 PS_ASSERT_PTR_NON_NULL(config, NULL); 293 PS_ASSERT_PTR_NON_NULL(config, false); 294 295 bool status = false; 296 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 297 if (!status) { 298 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 299 return false; 300 } 301 302 // find all rawImfiles matching the default query 303 psString query = psStringCopy( 304 "SELECT\n" 305 " p3ProcessedExp.*\n" 306 " FROM p4Run\n" 307 " JOIN p4InputExp\n" 308 " USING(p4_id)\n" 309 " JOIN p3ProcessedExp\n" 310 " ON p4InputExp.exp_tag = p3ProcessedExp.exp_tag\n" 311 " AND p4InputExp.p3_version = p3ProcessedExp.p3_version\n" 312 " WHERE\n" 313 " p4Run.state = 'run'\n" 314 " AND p3ProcessedExp.fault = 0\n" 315 ); 316 317 if (config->where) { 318 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4InputExp"); 319 psStringAppend(&query, " AND %s", whereClause); 320 psFree(whereClause); 321 } 322 323 // treat limit == 0 as "no limit" 324 if (limit) { 325 psString limitString = psDBGenerateLimitSQL(limit); 326 psStringAppend(&query, " %s", limitString); 327 psFree(limitString); 328 } 329 330 if (!p_psDBRunQuery(config->dbh, query)) { 331 psError(PS_ERR_UNKNOWN, false, "database error"); 332 psFree(query); 333 return false; 334 } 335 psFree(query); 336 337 psArray *output = p_psDBFetchResult(config->dbh); 338 if (!output) { 339 psErrorCode err = psErrorCodeLast(); 340 switch (err) { 341 case PS_ERR_DB_CLIENT: 342 psError(PXTOOLS_ERR_SYS, false, "database error"); 343 case PS_ERR_DB_SERVER: 344 psError(PXTOOLS_ERR_PROG, false, "database error"); 345 default: 346 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 347 } 348 349 return false; 350 } 351 if (!psArrayLength(output)) { 352 psError(PS_ERR_UNKNOWN, false, "no pending rawImfile rows found"); 353 psFree(output); 354 return true; 355 } 356 357 bool simple = false; 358 { 359 bool status = false; 360 simple = psMetadataLookupBool(&status, config->args, "-simple"); 361 if (!status) { 362 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 363 return false; 364 } 365 } 366 367 if (psArrayLength(output)) { 368 // negative simple so the default is true 369 if (!ippdbPrintMetadatas(stdout, output, "p4InputExp", !simple)) { 370 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 371 psFree(output); 372 return false; 373 } 374 } 375 376 psFree(output); 377 294 378 return true; 295 379 } … … 298 382 static bool imfileMode(pxConfig *config) 299 383 { 300 PS_ASSERT_PTR_NON_NULL(config, NULL); 384 PS_ASSERT_PTR_NON_NULL(config, false); 385 386 bool status = false; 387 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 388 if (!status) { 389 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 390 return false; 391 } 392 393 // find all rawImfiles matching the default query 394 psString query = psStringCopy( 395 "SELECT\n" 396 " rawImfile.*\n" 397 " FROM p4Run\n" 398 " JOIN p4InputExp\n" 399 " USING(p4_id)\n" 400 " JOIN rawImfile\n -- is there any reason not to refer back to rawimfiles?" 401 " ON p4InputExp.exp_tag = rawImfile.exp_tag\n" 402 " WHERE\n" 403 " p4Run.state = 'run'\n" 404 ); 405 if (config->where) { 406 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4InputExp"); 407 psStringAppend(&query, " AND %s", whereClause); 408 psFree(whereClause); 409 } 410 411 // treat limit == 0 as "no limit" 412 if (limit) { 413 psString limitString = psDBGenerateLimitSQL(limit); 414 psStringAppend(&query, " %s", limitString); 415 psFree(limitString); 416 } 417 418 if (!p_psDBRunQuery(config->dbh, query)) { 419 psError(PS_ERR_UNKNOWN, false, "database error"); 420 psFree(query); 421 return false; 422 } 423 psFree(query); 424 425 psArray *output = p_psDBFetchResult(config->dbh); 426 if (!output) { 427 psErrorCode err = psErrorCodeLast(); 428 switch (err) { 429 case PS_ERR_DB_CLIENT: 430 psError(PXTOOLS_ERR_SYS, false, "database error"); 431 case PS_ERR_DB_SERVER: 432 psError(PXTOOLS_ERR_PROG, false, "database error"); 433 default: 434 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 435 } 436 437 return false; 438 } 439 if (!psArrayLength(output)) { 440 psError(PS_ERR_UNKNOWN, false, "no pending rawImfile rows found"); 441 psFree(output); 442 return true; 443 } 444 445 bool simple = false; 446 { 447 bool status = false; 448 simple = psMetadataLookupBool(&status, config->args, "-simple"); 449 if (!status) { 450 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 451 return false; 452 } 453 } 454 455 if (psArrayLength(output)) { 456 // negative simple so the default is true 457 if (!ippdbPrintMetadatas(stdout, output, "p4InputImfile", !simple)) { 458 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 459 psFree(output); 460 return false; 461 } 462 } 463 464 psFree(output); 465 301 466 return true; 302 467 } -
trunk/ippTools/src/warptoolConfig.c
r11763 r11765 78 78 psMetadataAddS32(addinputexpArgs, PS_LIST_TAIL, "-p3_version", 0, 79 79 "define phase 3 version of exposure tag (required)", 0); 80 psMetadataAddBool( definerunArgs, PS_LIST_TAIL, "-magiced", 0,80 psMetadataAddBool(addinputexpArgs, PS_LIST_TAIL, "-magiced", 0, 81 81 "has this exposure been magiced", false); 82 82 … … 348 348 config->where = psMetadataAlloc(); 349 349 350 addWhereS32(p4_id); 350 { 351 psString str = NULL; 352 bool status = false; 353 if ((str = psMetadataLookupStr(&status, config->args, "-p4_id"))) { 354 if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "p4_id", 0, "==", (psS32)atoi(str))) { 355 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id"); 356 goto FAIL; 357 } 358 } 359 } 351 360 352 361 if (config->where->list->n < 1) {
Note:
See TracChangeset
for help on using the changeset viewer.
