Changeset 8341 for trunk/ippTools/src/regtool.c
- Timestamp:
- Aug 14, 2006, 5:51:39 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/regtool.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/regtool.c
r8329 r8341 69 69 70 70 char *query = 71 "SELECT newExp.* FROM newExp" 71 "SELECT newExp.*" 72 " FROM newExp" 73 " LEFT JOIN newImfile USING(exp_id)" 72 74 " LEFT JOIN rawScienceExp USING(exp_id)" 73 " LEFT JOIN rawDetrendExp USING (exp_id)" 74 " LEFT JOIN newImfile USING (exp_id)" 75 " WHERE newExp.exp_id is NOT NULL" 76 " AND rawScienceExp.exp_id IS NULL" 77 " AND rawDetrendExp.exp_id IS NULL" 78 " AND newImfile.exp_id IS NULL" 79 " AND newExp.imfiles = (SELECT COUNT(exp_id)" 80 " FROM rawImfile GROUP BY exp_id)"; 75 " LEFT JOIN rawDetrendExp USING(exp_id)" 76 " WHERE" 77 " newExp.exp_id IS NOT NULL" 78 " AND newImfile.exp_id IS NULL" 79 " AND rawScienceExp.exp_id IS NULL" 80 " AND newExp.imfiles =" 81 " (SELECT COUNT(exp_id) FROM rawImfile" 82 " WHERE rawImfile.exp_id = newExp.exp_id)" 83 ; 81 84 82 85 if (!p_psDBRunQuery(config->dbh, query)) { … … 176 179 // exp_id is not in newImfile 177 180 // that the correct count of imfiles is in rawImfile 178 psString query = psStringCopy("SELECT newExp.* FROM newExp LEFT JOIN newImfile USING(exp_id) LEFT JOIN rawScienceExp USING(exp_id) LEFT JOIN rawDetrendExp USING(exp_id) WHERE newExp.exp_id IS NOT NULL AND newImfile.exp_id IS NULL AND rawScienceExp.exp_id IS NULL AND newExp.imfiles = (SELECT COUNT(exp_id) FROM rawImfile GROUP BY exp_id)"); 181 182 psString query = psStringCopy( 183 "SELECT newExp.*" 184 " FROM newExp" 185 " LEFT JOIN newImfile USING(exp_id)" 186 " LEFT JOIN rawScienceExp USING(exp_id)" 187 " LEFT JOIN rawDetrendExp USING(exp_id)" 188 " WHERE" 189 " newExp.exp_id IS NOT NULL" 190 " AND newImfile.exp_id IS NULL" 191 " AND rawScienceExp.exp_id IS NULL" 192 " AND newExp.imfiles =" 193 " (SELECT COUNT(exp_id) FROM rawImfile" 194 " WHERE rawImfile.exp_id = newExp.exp_id)" 195 ); 179 196 180 197 { … … 418 435 // XXX search by the whole frame some imfiles without a newExp don't get 419 436 // processed -- this may not be the correct thing to do 420 char *query =437 psString query = psStringCopy( 421 438 "SELECT * FROM" 422 439 " (SELECT newImfile.* FROM newImfile" … … 427 444 " AND rawScienceExp.exp_id IS NULL" 428 445 " AND rawDetrendExp.exp_id IS NULL) AS foo" 429 " %s"; // WHERE class is generated from exp_id, class, & class_id446 ); // WHERE class is generated from exp_id, class, & class_id 430 447 431 448 char *whereClaus = NULL; … … 437 454 if (!status) { 438 455 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id"); 456 psFree(query); 439 457 return false; 440 458 } … … 443 461 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); 444 462 psFree(where); 463 psFree(query); 445 464 return false; 446 465 } … … 449 468 if (!status) { 450 469 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class"); 470 psFree(query); 451 471 return false; 452 472 } … … 455 475 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 456 476 psFree(where); 477 psFree(query); 457 478 return false; 458 479 } … … 461 482 if (!status) { 462 483 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id"); 484 psFree(query); 463 485 return false; 464 486 } … … 467 489 psError(PS_ERR_UNKNOWN, false, "failed to add item class_id"); 468 490 psFree(where); 491 psFree(query); 469 492 return false; 470 493 } … … 472 495 473 496 // there's not 474 whereClaus = psDBGenerateWhereSQL(where );497 whereClaus = psDBGenerateWhereSQL(where, NULL); 475 498 psFree(where); 476 } 477 478 if (!p_psDBRunQuery(config->dbh, query, whereClaus)) { 499 if (whereClaus) { 500 psStringAppend(&query, " %s", whereClaus); 501 psFree(whereClaus); 502 } 503 } 504 505 if (!p_psDBRunQuery(config->dbh, query)) { 479 506 psError(PS_ERR_UNKNOWN, false, "database error"); 480 psFree( whereClaus);481 return false; 482 } 483 psFree( whereClaus);507 psFree(query); 508 return false; 509 } 510 psFree(query); 484 511 485 512 psArray *newImfiles = p_psDBFetchResult(config->dbh);
Note:
See TracChangeset
for help on using the changeset viewer.
