Changeset 9057 for trunk/ippTools/src/regtool.c
- Timestamp:
- Sep 28, 2006, 5:25:54 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/regtool.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/regtool.c
r9028 r9057 72 72 "SELECT newExp.*" 73 73 " FROM newExp" 74 " LEFT JOIN newImfile USING(exp_ id)"75 " LEFT JOIN rawScienceExp USING(exp_ id)"76 " LEFT JOIN rawDetrendExp USING(exp_ id)"74 " LEFT JOIN newImfile USING(exp_tag)" 75 " LEFT JOIN rawScienceExp USING(exp_tag)" 76 " LEFT JOIN rawDetrendExp USING(exp_tag)" 77 77 " WHERE" 78 " newExp.exp_ idIS NOT NULL"79 " AND newImfile.exp_ idIS NULL"80 " AND rawScienceExp.exp_ idIS NULL"78 " newExp.exp_tag IS NOT NULL" 79 " AND newImfile.exp_tag IS NULL" 80 " AND rawScienceExp.exp_tag IS NULL" 81 81 " AND newExp.imfiles =" 82 " (SELECT COUNT(exp_ id) FROM rawImfile"83 " WHERE rawImfile.exp_ id = newExp.exp_id)"82 " (SELECT COUNT(exp_tag) FROM rawImfile" 83 " WHERE rawImfile.exp_tag = newExp.exp_tag)" 84 84 ; 85 85 … … 123 123 124 124 // select newImfiles that: 125 // exp_ idis in newExp126 // don't have their exp_ idin rawScienceExp127 // don't have their exp_ idin rawDetrendExp128 // XXX having the same exp_ idin newExp and raw*Exp is probably an error125 // exp_tag is in newExp 126 // don't have their exp_tag in rawScienceExp 127 // don't have their exp_tag in rawDetrendExp 128 // XXX having the same exp_tag in newExp and raw*Exp is probably an error 129 129 // that should be checked for 130 130 char *query = 131 131 "SELECT newImfile.* FROM newImfile" 132 " LEFT JOIN newExp USING(exp_ id)"133 " LEFT JOIN rawScienceExp USING(exp_ id)"134 " LEFT JOIN rawDetrendExp USING (exp_ id)"135 " WHERE newExp.exp_ idis NOT NULL"136 " AND rawScienceExp.exp_ idIS NULL"137 " AND rawDetrendExp.exp_ idIS NULL";132 " LEFT JOIN newExp USING(exp_tag)" 133 " LEFT JOIN rawScienceExp USING(exp_tag)" 134 " LEFT JOIN rawDetrendExp USING (exp_tag)" 135 " WHERE newExp.exp_tag is NOT NULL" 136 " AND rawScienceExp.exp_tag IS NULL" 137 " AND rawDetrendExp.exp_tag IS NULL"; 138 138 139 139 if (!p_psDBRunQuery(config->dbh, query)) { … … 175 175 PS_ASSERT_PTR_NON_NULL(config, false); 176 176 177 // make sure that the exp_ id(s) are ready to be updated based on:178 // exp_ idis not in rawScienceExp179 // exp_ idis not in rawDetrendExp180 // exp_ idis not in newImfile177 // make sure that the exp_tag(s) are ready to be updated based on: 178 // exp_tag is not in rawScienceExp 179 // exp_tag is not in rawDetrendExp 180 // exp_tag is not in newImfile 181 181 // that the correct count of imfiles is in rawImfile 182 182 … … 184 184 "SELECT newExp.*" 185 185 " FROM newExp" 186 " LEFT JOIN newImfile USING(exp_ id)"187 " LEFT JOIN rawScienceExp USING(exp_ id)"188 " LEFT JOIN rawDetrendExp USING(exp_ id)"186 " LEFT JOIN newImfile USING(exp_tag)" 187 " LEFT JOIN rawScienceExp USING(exp_tag)" 188 " LEFT JOIN rawDetrendExp USING(exp_tag)" 189 189 " WHERE" 190 " newExp.exp_ idIS NOT NULL"191 " AND newImfile.exp_ idIS NULL"192 " AND rawScienceExp.exp_ idIS NULL"190 " newExp.exp_tag IS NOT NULL" 191 " AND newImfile.exp_tag IS NULL" 192 " AND rawScienceExp.exp_tag IS NULL" 193 193 " AND newExp.imfiles =" 194 " (SELECT COUNT(exp_ id) FROM rawImfile"195 " WHERE rawImfile.exp_ id = newExp.exp_id)"194 " (SELECT COUNT(exp_tag) FROM rawImfile" 195 " WHERE rawImfile.exp_tag = newExp.exp_tag)" 196 196 ); 197 197 198 198 { 199 199 bool status = false; 200 psString exp_ id = psMetadataLookupStr(&status, config->args, "-exp_id");200 psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag"); 201 201 if (!status) { 202 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_ id");202 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag"); 203 203 psFree(query); 204 204 return false; 205 205 } 206 if (exp_ id) {207 psStringAppend(&query, " AND newExp.exp_ id = '%s'", exp_id);206 if (exp_tag) { 207 psStringAppend(&query, " AND newExp.exp_tag = '%s'", exp_tag); 208 208 } 209 209 } … … 359 359 psArray *rawImfiles = NULL; 360 360 { 361 // build a query to search by exp_ id361 // build a query to search by exp_tag 362 362 psMetadata *where = psMetadataAlloc(); 363 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_ id", 0, "==", newExp->exp_id)) {363 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", newExp->exp_tag)) { 364 364 // rollback 365 365 if (!psDBRollback(config->dbh)) { 366 366 psError(PS_ERR_UNKNOWN, false, "database error"); 367 367 } 368 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_ id");368 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag"); 369 369 psFree(where); 370 370 psFree(newExp); … … 381 381 psError(PS_ERR_UNKNOWN, false, "database error"); 382 382 } 383 psError(PS_ERR_UNKNOWN, false, "found no rawImfiles associated with exp_ id %s", newExp->exp_id);383 psError(PS_ERR_UNKNOWN, false, "found no rawImfiles associated with exp_tag %s", newExp->exp_tag); 384 384 psFree(newExp); 385 385 psFree(output); … … 439 439 "SELECT * FROM" 440 440 " (SELECT newImfile.* FROM newImfile" 441 " LEFT JOIN newExp USING(exp_ id)"442 " LEFT JOIN rawScienceExp USING(exp_ id)"443 " LEFT JOIN rawDetrendExp USING (exp_ id)"444 " WHERE newExp.exp_ idIS NOT NULL"445 " AND rawScienceExp.exp_ idIS NULL"446 " AND rawDetrendExp.exp_ idIS NULL) AS foo"447 ); // WHERE class is generated from exp_ id, class, & class_id441 " LEFT JOIN newExp USING(exp_tag)" 442 " LEFT JOIN rawScienceExp USING(exp_tag)" 443 " LEFT JOIN rawDetrendExp USING (exp_tag)" 444 " WHERE newExp.exp_tag IS NOT NULL" 445 " AND rawScienceExp.exp_tag IS NULL" 446 " AND rawDetrendExp.exp_tag IS NULL) AS foo" 447 ); // WHERE class is generated from exp_tag, class, & class_id 448 448 449 449 { 450 // build a query to search by exp_ id, class, class_id450 // build a query to search by exp_tag, class, class_id 451 451 psMetadata *where = psMetadataAlloc(); 452 452 bool status = false; 453 psString exp_ id = psMetadataLookupStr(&status, config->args, "-exp_id");453 psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag"); 454 454 if (!status) { 455 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_ id");455 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag"); 456 456 psFree(query); 457 457 return false; 458 458 } 459 if (exp_ id) {460 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_ id", 0, "==", exp_id)) {461 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_ id");459 if (exp_tag) { 460 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) { 461 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag"); 462 462 psFree(where); 463 463 psFree(query); … … 619 619 { 620 620 return p1PendingExpRowAlloc( 621 newExp->exp_ id,621 newExp->exp_tag, 622 622 newExp->camera, 623 623 newExp->telescope, … … 642 642 643 643 return p2PendingExpRowAlloc( 644 exp->exp_ id,644 exp->exp_tag, 645 645 "my recipe", 646 646 0xff, // XXX calc version number … … 652 652 { 653 653 return p2PendingImfileRowAlloc( 654 rawImfile->exp_ id,654 rawImfile->exp_tag, 655 655 rawImfile->class_id, 656 656 rawImfile->uri, … … 796 796 797 797 return rawDetrendExpRowAlloc( 798 exp->exp_ id,798 exp->exp_tag, 799 799 exp->camera, 800 800 exp->telescope, … … 941 941 942 942 return rawImfileRowAlloc( 943 imfile->exp_ id,943 imfile->exp_tag, 944 944 imfile->class, 945 945 imfile->class_id,
Note:
See TracChangeset
for help on using the changeset viewer.
