Changeset 12024 for trunk/ippTools/src/camtool.c
- Timestamp:
- Feb 23, 2007, 3:41:56 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/camtool.c (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/camtool.c
r11997 r12024 96 96 psString query = psStringCopy( 97 97 "SELECT" 98 " p3PendingExp.*,"98 " camPendingExp.*," 99 99 " rawExp.camera," 100 100 " rawExp.workdir" 101 " FROM p3PendingExp"101 " FROM camPendingExp" 102 102 " JOIN rawExp" 103 103 " USING(exp_tag)" 104 " LEFT JOIN p3ProcessedExp"104 " LEFT JOIN camProcessedExp" 105 105 " USING(exp_tag)" 106 " LEFT JOIN p3Mask"107 " ON p3PendingExp.label = p3Mask.label"106 " LEFT JOIN camMask" 107 " ON camPendingExp.label = camMask.label" 108 108 " WHERE" 109 " p3ProcessedExp.exp_tag IS NULL"110 " AND p3Mask.label IS NULL"109 " camProcessedExp.exp_tag IS NULL" 110 " AND camMask.label IS NULL" 111 111 ); 112 112 113 113 if (config->where) { 114 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p3PendingExp");114 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "camPendingExp"); 115 115 psStringAppend(&query, " AND %s", whereClause); 116 116 psFree(whereClause); … … 138 138 if (!psArrayLength(output)) { 139 139 // XXX check psError here 140 psError(PS_ERR_UNKNOWN, false, "no p3PendingExp rows found");140 psError(PS_ERR_UNKNOWN, false, "no camPendingExp rows found"); 141 141 psFree(output); 142 142 return true; … … 154 154 155 155 // negate simple so the default is true 156 if (!ippdbPrintMetadatas(stdout, output, " p3PendingExp", !simple)) {156 if (!ippdbPrintMetadatas(stdout, output, "camPendingExp", !simple)) { 157 157 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 158 158 psFree(output); … … 171 171 psString query = psStringCopy( 172 172 "SELECT" 173 " p2ProcessedImfile.*,"173 " chipProcessedImfile.*," 174 174 " rawExp.camera," 175 175 " rawExp.workdir" 176 " FROM p3PendingExp"177 " JOIN p2ProcessedImfile"178 " USING(exp_tag, p2_version)"176 " FROM camPendingExp" 177 " JOIN chipProcessedImfile" 178 " USING(exp_tag, chip_version)" 179 179 " JOIN rawExp" 180 180 " USING(exp_tag)" 181 " LEFT JOIN p3ProcessedExp"181 " LEFT JOIN camProcessedExp" 182 182 " USING(exp_tag)" 183 " LEFT JOIN p3Mask"184 " ON p3PendingExp.label = p3Mask.label"183 " LEFT JOIN camMask" 184 " ON camPendingExp.label = camMask.label" 185 185 " WHERE" 186 " p3ProcessedExp.exp_tag IS NULL"187 " AND p3Mask.label IS NULL"186 " camProcessedExp.exp_tag IS NULL" 187 " AND camMask.label IS NULL" 188 188 ); 189 189 190 190 if (config->where) { 191 psString whereClause = psDBGenerateWhereConditionSQL(config->where, " p2ProcessedImfile");191 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "chipProcessedImfile"); 192 192 psStringAppend(&query, " AND %s", whereClause); 193 193 psFree(whereClause); … … 208 208 if (!psArrayLength(output)) { 209 209 // XXX check psError here 210 psError(PS_ERR_UNKNOWN, false, "no pending p2ProcessedImfile rows found");210 psError(PS_ERR_UNKNOWN, false, "no pending chipProcessedImfile rows found"); 211 211 psFree(output); 212 212 return true; … … 224 224 225 225 // negate simple so the default is true 226 if (!ippdbPrintMetadatas(stdout, output, " p2ProcessedImfile", !simple)) {226 if (!ippdbPrintMetadatas(stdout, output, "chipProcessedImfile", !simple)) { 227 227 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 228 228 psFree(output); … … 362 362 363 363 psString query = psStringCopy( 364 "SELECT p3PendingExp.*"365 " FROM p3PendingExp"366 " LEFT JOIN p3ProcessedExp"364 "SELECT camPendingExp.*" 365 " FROM camPendingExp" 366 " LEFT JOIN camProcessedExp" 367 367 " USING(exp_tag)" 368 368 " WHERE" 369 " p3ProcessedExp.exp_tag IS NULL"370 " AND p3PendingExp.exp_tag = '%s'"369 " camProcessedExp.exp_tag IS NULL" 370 " AND camPendingExp.exp_tag = '%s'" 371 371 ); 372 372 … … 384 384 } 385 385 if (!psArrayLength(output)) { 386 psError(PS_ERR_UNKNOWN, false, "no p3PendingExp rows found");386 psError(PS_ERR_UNKNOWN, false, "no camPendingExp rows found"); 387 387 psFree(output); 388 388 return true; … … 390 390 391 391 // start a transaction so we don't end up with an exp_tag is both 392 // p3PendingExp & p3ProcessedExp392 // camPendingExp & camProcessedExp 393 393 if (!psDBTransaction(config->dbh)) { 394 394 psError(PS_ERR_UNKNOWN, false, "database error"); … … 397 397 } 398 398 399 p3PendingExpRow *pendingRow = p3PendingExpObjectFromMetadata(output->data[0]);399 camPendingExpRow *pendingRow = camPendingExpObjectFromMetadata(output->data[0]); 400 400 psFree(output); 401 // create a new p3ProcessedImfile object402 p3ProcessedExpRow *row = p3ProcessedExpRowAlloc(401 // create a new camProcessedImfile object 402 camProcessedExpRow *row = camProcessedExpRowAlloc( 403 403 exp_tag, 404 pendingRow-> p3_version,405 pendingRow-> p2_version,404 pendingRow->cam_version, 405 pendingRow->chip_version, 406 406 pendingRow->label, 407 407 uri, … … 422 422 ); 423 423 424 // insert the new row into the p3ProcessedImfile table425 if (! p3ProcessedExpInsertObject(config->dbh, row)) {424 // insert the new row into the camProcessedImfile table 425 if (!camProcessedExpInsertObject(config->dbh, row)) { 426 426 // rollback 427 427 if (!psDBRollback(config->dbh)) { … … 435 435 psFree(row); 436 436 437 // delete the p3PendingExp row from the database438 if (! p3PendingExpDeleteObject(config->dbh, pendingRow)) {437 // delete the camPendingExp row from the database 438 if (!camPendingExpDeleteObject(config->dbh, pendingRow)) { 439 439 // rollback 440 440 if (!psDBRollback(config->dbh)) { … … 448 448 psFree(pendingRow); 449 449 450 // point of no return for p3PendingExp -> p3ProcessedExp450 // point of no return for camPendingExp -> camProcessedExp 451 451 if (!psDBCommit(config->dbh)) { 452 452 psError(PS_ERR_UNKNOWN, false, "database error"); … … 476 476 psString query = psStringCopy( 477 477 "SELECT" 478 " p3ProcessedExp.*,"478 " camProcessedExp.*," 479 479 " rawExp.camera," 480 480 " rawExp.workdir" 481 " FROM p3ProcessedExp"481 " FROM camProcessedExp" 482 482 " JOIN rawExp" 483 483 " USING(exp_tag)" 484 484 " WHERE" 485 " p3ProcessedExp.exp_tag IS NOT NULL"485 " camProcessedExp.exp_tag IS NOT NULL" 486 486 ); 487 487 … … 494 494 if (faulted) { 495 495 // list only faulted rows 496 psStringAppend(&query, " %s", "AND p3ProcessedExp.fault != 0");496 psStringAppend(&query, " %s", "AND camProcessedExp.fault != 0"); 497 497 } else { 498 498 // don't list faulted rows 499 psStringAppend(&query, " %s", "AND p3ProcessedExp.fault = 0");499 psStringAppend(&query, " %s", "AND camProcessedExp.fault = 0"); 500 500 } 501 501 … … 521 521 if (!psArrayLength(output)) { 522 522 // XXX check psError here 523 psError(PS_ERR_UNKNOWN, false, "no p3ProcessedExp rows found");523 psError(PS_ERR_UNKNOWN, false, "no camProcessedExp rows found"); 524 524 psFree(output); 525 525 return true; … … 537 537 538 538 // negate simple so the default is true 539 if (!ippdbPrintMetadatas(stdout, output, " p3ProcessedExp", !simple)) {539 if (!ippdbPrintMetadatas(stdout, output, "camProcessedExp", !simple)) { 540 540 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 541 541 psFree(output); … … 560 560 } 561 561 562 if (!pxSetFaultCode(config->dbh, " p3ProcessedExp", config->where, code)) {562 if (!pxSetFaultCode(config->dbh, "camProcessedExp", config->where, code)) { 563 563 psError(PS_ERR_UNKNOWN, false, "failed to set set fault flag"); 564 564 return false; … … 584 584 } 585 585 586 if (! p3MaskInsert(config->dbh, label)) {586 if (!camMaskInsert(config->dbh, label)) { 587 587 psError(PS_ERR_UNKNOWN, false, "database error"); 588 588 return false; … … 596 596 PS_ASSERT_PTR_NON_NULL(config, false); 597 597 598 psString query = psStringCopy("SELECT * FROM p3Mask");598 psString query = psStringCopy("SELECT * FROM camMask"); 599 599 600 600 if (!p_psDBRunQuery(config->dbh, query)) { … … 612 612 if (!psArrayLength(output)) { 613 613 // XXX check psError here 614 psError(PS_ERR_UNKNOWN, false, "no p3Mask rows found");614 psError(PS_ERR_UNKNOWN, false, "no camMask rows found"); 615 615 psFree(output); 616 616 return true; … … 628 628 629 629 // negative simple so the default is true 630 if (!ippdbPrintMetadatas(stdout, output, " p3Mask", !simple)) {630 if (!ippdbPrintMetadatas(stdout, output, "camMask", !simple)) { 631 631 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 632 632 psFree(output); … … 654 654 } 655 655 656 char *query = "DELETE FROM p3Mask WHERE label = '%s'";656 char *query = "DELETE FROM camMask WHERE label = '%s'"; 657 657 658 658 if (!p_psDBRunQuery(config->dbh, query, label)) {
Note:
See TracChangeset
for help on using the changeset viewer.
