Changeset 25789 for trunk/ippTools/src/addtool.c
- Timestamp:
- Oct 6, 2009, 3:48:25 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/addtool.c (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/addtool.c
r25299 r25789 106 106 107 107 psMetadata *where = psMetadataAlloc(); 108 pxaddGetSearchArgs (config, where); 109 pxAddLabelSearchArgs (config, where, "-label", "addRun.label", "=="); 110 PXOPT_COPY_STR(config->args, where, "-reduction", "addRun.reduction", "=="); 108 pxcamGetSearchArgs (config, where); 109 PXOPT_COPY_S64(config->args, where, "-cam_id", "camRun.cam_id", "=="); 110 pxAddLabelSearchArgs (config, where, "-label", "camRun.label", "=="); 111 PXOPT_COPY_STR(config->args, where, "-reduction", "camRun.reduction", "=="); 111 112 112 113 if (!psListLength(where->list) && … … 121 122 PXOPT_LOOKUP_STR(reduction, config->args, "-set_reduction", false, false); 122 123 PXOPT_LOOKUP_STR(dvodb, config->args, "-set_dvodb", false, false); 124 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false); 125 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 123 126 124 127 // find the cam_id of all the exposures that we want to queue up. … … 130 133 } 131 134 132 // use psDBGenerateWhere SQL because the SQL yields an intermediate table135 // use psDBGenerateWhereConditionSQL because the SQL ends in a WHERE 133 136 if (where && psListLength(where->list)) { 134 137 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); … … 136 139 psFree(whereClause); 137 140 } 138 139 141 psFree(where); 140 142 … … 153 155 if (!psArrayLength(output)) { 154 156 psTrace("addtool", PS_LOG_INFO, "no rows found"); 157 psFree(output); 158 return true; 159 } 160 161 if (pretend) { 162 // negative simple so the default is true 163 if (!ippdbPrintMetadatas(stdout, output, "addRun", !simple)) { 164 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 165 psFree(output); 166 return false; 167 } 155 168 psFree(output); 156 169 return true; … … 175 188 psMetadata *md = output->data[i]; 176 189 177 addRunRow *row = addRunObjectFromMetadata(md);190 camRunRow *row = camRunObjectFromMetadata(md); 178 191 if (!row) { 179 192 psError(PS_ERR_UNKNOWN, false, "failed to convert metadata into addRun"); … … 218 231 219 232 psMetadata *where = psMetadataAlloc(); 220 pxaddGetSearchArgs (config, where);221 233 PXOPT_COPY_S64(config->args, where, "-add_id", "addRun.add_id", "=="); 234 PXOPT_COPY_S64(config->args, where, "-cam_id", "camRun.cam_id", "=="); 235 pxcamGetSearchArgs (config, where); // most search arguments based on camera 236 222 237 PXOPT_COPY_STR(config->args, where, "-label", "addRun.label", "=="); 223 238 PXOPT_COPY_STR(config->args, where, "-state", "addRun.state", "=="); … … 267 282 268 283 psMetadata *where = psMetadataAlloc(); 269 pxaddGetSearchArgs (config, where);270 284 PXOPT_COPY_S64(config->args, where, "-add_id", "addRun.add_id", "=="); 285 PXOPT_COPY_S64(config->args, where, "-cam_id", "camRun.cam_id", "=="); 286 pxcamGetSearchArgs (config, where); 271 287 pxAddLabelSearchArgs (config, where, "-label", "addRun.label", "=="); 272 288 PXOPT_COPY_STR(config->args, where, "-reduction", "addRun.reduction", "=="); … … 325 341 } 326 342 327 /* static bool pendingimfileMode(pxConfig *config) */328 /* { */329 /* PS_ASSERT_PTR_NON_NULL(config, false); */330 331 /* psMetadata *where = psMetadataAlloc(); */332 /* pxaddGetSearchArgs (config, where); */333 /* PXOPT_COPY_S64(config->args, where, "-add_id", "addRun.add_id", "=="); */334 /* pxAddLabelSearchArgs (config, where, "-label", "addRun.label", "=="); */335 /* PXOPT_COPY_STR(config->args, where, "-reduction", "addRun.reduction", "=="); */336 /* PXOPT_COPY_S64(config->args, where, "-chip_id", "addRun.chip_id", "=="); */337 /* PXOPT_COPY_STR(config->args, where, "-class_id", "addProcessedExp.class_id", "=="); */338 339 /* PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); */340 341 /* psString query = pxDataGet("addtool_find_pendingimfile.sql"); */342 /* if (!query) { */343 /* psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); */344 /* return false; */345 /* } */346 347 /* // use psDBGenerateWhereSQL because the SQL yields an intermediate table */348 /* if (psListLength(where->list)) { */349 /* psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); */350 /* psStringAppend(&query, " AND %s", whereClause); */351 /* psFree(whereClause); */352 /* } */353 /* psFree(where); */354 355 /* if (!p_psDBRunQuery(config->dbh, query)) { */356 /* psError(PS_ERR_UNKNOWN, false, "database error"); */357 /* psFree(query); */358 /* return false; */359 /* } */360 /* psFree(query); */361 362 /* psArray *output = p_psDBFetchResult(config->dbh); */363 /* if (!output) { */364 /* psError(PS_ERR_UNKNOWN, false, "database error"); */365 /* return false; */366 /* } */367 /* if (!psArrayLength(output)) { */368 /* psTrace("addtool", PS_LOG_INFO, "no rows found"); */369 /* psFree(output); */370 /* return true; */371 /* } */372 373 /* // negate simple so the default is true */374 /* if (!ippdbPrintMetadatas(stdout, output, "addProcessedExp", !simple)) { */375 /* psError(PS_ERR_UNKNOWN, false, "failed to print array"); */376 /* psFree(output); */377 /* return false; */378 /* } */379 380 /* psFree(output); */381 382 /* return true; */383 /* } */384 385 343 static bool addprocessedexpMode(pxConfig *config) 386 344 { … … 392 350 // optional 393 351 PXOPT_LOOKUP_F32(dtime_addstar, config->args, "-dtime_addstar", false, false); 394 395 352 PXOPT_LOOKUP_S32(n_stars, config->args, "-n_stars", false, false); 396 397 353 PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", false, false); 398 399 354 PXOPT_LOOKUP_S64(magicked, config->args, "-magicked", false, false); 400 355 … … 469 424 return false; 470 425 } 471 472 // NULL for end_stage means go as far as possible473 // EAM : skip here if fault != 0474 // Also, we can run fake even if tess_id is not defined475 /* if (fault || (pendingRow->end_stage && psStrcasestr(pendingRow->end_stage, "add"))) { */476 /* psFree(row); */477 /* psFree(pendingRow); */478 /* if (!psDBCommit(config->dbh)) { */479 /* psError(PS_ERR_UNKNOWN, false, "database error"); */480 /* return false; */481 /* } */482 /* return true; */483 /* } */484 426 psFree(row); 485 // else continue on...486 487 /* if (!pxfakeQueueByAddID(config, */488 /* pendingRow->add_id, */489 /* pendingRow->workdir, */490 /* pendingRow->label, */491 /* pendingRow->reduction, */492 /* pendingRow->expgroup, */493 /* pendingRow->dvodb, */494 /* pendingRow->tess_id, */495 /* pendingRow->end_stage */496 /* )) { */497 /* // rollback */498 /* if (!psDBRollback(config->dbh)) { */499 /* psError(PS_ERR_UNKNOWN, false, "database error"); */500 /* } */501 /* psError(PS_ERR_UNKNOWN, false, "failed to queue new fakeRun"); */502 /* psFree(pendingRow); */503 /* return false; */504 /* } */505 427 psFree(pendingRow); 506 428 … … 524 446 // generate restrictions 525 447 psMetadata *where = psMetadataAlloc(); 526 pxaddGetSearchArgs (config, where);527 448 PXOPT_COPY_S64(config->args, where, "-add_id", "addRun.add_id", "=="); 449 PXOPT_COPY_S64(config->args, where, "-cam_id", "camRun.cam_id", "=="); 450 pxcamGetSearchArgs (config, where); 528 451 pxAddLabelSearchArgs (config, where, "-label", "addRun.label", "=="); 529 452 PXOPT_COPY_STR(config->args, where, "-reduction", "addRun.reduction", "=="); … … 613 536 614 537 psMetadata *where = psMetadataAlloc(); 615 pxaddGetSearchArgs (config, where);616 538 PXOPT_COPY_S64(config->args, where, "-add_id", "addRun.add_id", "=="); 539 PXOPT_COPY_S64(config->args, where, "-cam_id", "camRun.cam_id", "=="); 540 pxcamGetSearchArgs (config, where); 617 541 pxAddLabelSearchArgs (config, where, "-label", "addRun.label", "=="); 618 542 PXOPT_COPY_STR(config->args, where, "-reduction", "addRun.reduction", "=="); 619 /* PXOPT_COPY_S16(config->args, where, "-fault", "addProcessedExp.fault", "=="); */620 543 621 544 if (!psListLength(where->list) && !psMetadataLookupBool(NULL, config->args, "-all")) { … … 710 633 PXOPT_COPY_S64(config->args, where, "-add_id", "add_id", "=="); 711 634 PXOPT_COPY_S64(config->args, where, "-cam_id", "cam_id", "=="); 712 /* PXOPT_COPY_STR(config->args, where, "-class", "class", "=="); */713 /* PXOPT_COPY_STR(config->args, where, "-class_id", "class_id", "=="); */714 635 715 636 if (!pxSetFaultCode(config->dbh, "addProcessedExp", where, fault)) { … … 776 697 return true; 777 698 } 778 779 699 780 700 static bool unblockMode(pxConfig *config)
Note:
See TracChangeset
for help on using the changeset viewer.
