Changeset 24664
- Timestamp:
- Jul 3, 2009, 11:48:59 AM (17 years ago)
- Location:
- trunk/ippTools
- Files:
-
- 5 edited
-
share/stacktool_definebyquery_insert.sql (modified) (2 diffs)
-
share/stacktool_definebyquery_insert_random_part1.sql (modified) (2 diffs)
-
share/stacktool_definebyquery_insert_random_part2.sql (modified) (1 diff)
-
src/stacktool.c (modified) (4 diffs)
-
src/stacktoolConfig.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/share/stacktool_definebyquery_insert.sql
r23688 r24664 12 12 JOIN camRun 13 13 USING(cam_id) 14 JOIN camProcessedExp 15 USING(cam_id) 14 16 JOIN chipRun 15 17 USING(chip_id) … … 17 19 USING(exp_id) 18 20 WHERE 19 warpSkyfile.skycell_id = ' %s'21 warpSkyfile.skycell_id = '@SKYCELL_ID@' 20 22 AND warpRun.state = 'full' 21 AND rawExp.filter = ' %s'23 AND rawExp.filter = '@FILTER@' 22 24 AND warpSkyfile.fault = 0 23 25 AND warpSkyfile.quality = 0 -
trunk/ippTools/share/stacktool_definebyquery_insert_random_part1.sql
r23688 r24664 19 19 JOIN camRun 20 20 USING(cam_id) 21 JOIN camProcessedExp 22 USING(cam_id) 21 23 JOIN chipRun 22 24 USING(chip_id) … … 24 26 USING(exp_id) 25 27 WHERE 26 skycell_id = ' %s'28 skycell_id = '@SKYCELL_ID@' 27 29 AND warpRun.state = 'full' 28 AND rawExp.filter = ' %s' -- the result of the query is grouped by filter and inserted for one at a time30 AND rawExp.filter = '@FILTER@' -- the result of the query is grouped by filter and inserted for one at a time 29 31 AND warpSkyfile.fault = 0 30 32 AND warpSkyfile.quality = 0 -
trunk/ippTools/share/stacktool_definebyquery_insert_random_part2.sql
r19249 r24664 5 5 -- to get a random set of N. 6 6 ORDER BY rnd_num 7 LIMIT %d7 LIMIT @RANDOM_LIMIT@ 8 8 ) AS randomWarps -
trunk/ippTools/src/stacktool.c
r24661 r24664 153 153 154 154 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 155 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false); 155 156 PXOPT_LOOKUP_TIME(registered, config->args, "-registered", false, false); 156 157 … … 236 237 } 237 238 if (!psArrayLength(output)) { 238 psTrace("stacktool", PS_LOG_INFO, "no rows found"); 239 psWarning("stacktool: no rows found"); 240 psFree(output); 241 psFree(where); 242 return true; 243 } 244 if (pretend) { 245 // negative simple so the default is true 246 if (!ippdbPrintMetadatas(stdout, output, "stackSkycells", !simple)) { 247 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 248 psFree(output); 249 psFree(where); 250 return false; 251 } 239 252 psFree(output); 240 253 psFree(where); … … 362 375 psFree(idString); 363 376 377 // replace @FILTER@, @SKYCELL_ID@, @RANDOM_LIMIT@ 378 psStringSubstitute(&thisInsert, filter, "@FILTER@"); 379 psStringSubstitute(&thisInsert, skycell_id, "@SKYCELL_ID@"); 380 381 if (randomLimit > 0) { 382 psString limString = NULL; 383 psStringAppend(&limString, "%d", randomLimit); 384 psStringSubstitute(&thisInsert, limString, "@RANDOM_LIMIT@"); 385 psFree(limString); 386 } 387 364 388 // XXX this insert uses a select to generate the list of warp_ids for the stack, 365 389 // we have applied a set of criteria above (WHERE) to select the relevant warps 366 390 // this insert needs to use exactly the same restrictions (race condition is probably not critical) 367 391 // the insert below seems to only restrict matches to the skycell, tess, and filter 368 if ((randomLimit > 0 && !p_psDBRunQueryF(config->dbh, thisInsert, skycell_id, filter, randomLimit)) || 369 (randomLimit <= 0 && !p_psDBRunQueryF(config->dbh, thisInsert, skycell_id, filter))) { 392 if (!p_psDBRunQuery(config->dbh, thisInsert)) { 370 393 psError(PS_ERR_UNKNOWN, false, "database error"); 371 394 psFree(thisInsert); … … 379 402 } 380 403 psFree(thisInsert); 404 405 # if (0) 406 { 407 psArray *output = p_psDBFetchResult(config->dbh); 408 if (!output) { 409 psErrorCode err = psErrorCodeLast(); 410 switch (err) { 411 case PS_ERR_DB_CLIENT: 412 psError(PXTOOLS_ERR_SYS, false, "database error"); 413 case PS_ERR_DB_SERVER: 414 psError(PXTOOLS_ERR_PROG, false, "database error"); 415 default: 416 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 417 } 418 psFree(where); 419 return false; 420 } 421 if (!psArrayLength(output)) { 422 psWarning("stacktool (definebyquery, insert): no rows found"); 423 psFree(output); 424 psFree(where); 425 return true; 426 } 427 // negative simple so the default is true 428 if (!ippdbPrintMetadatas(stdout, output, "stackSkycells", !simple)) { 429 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 430 psFree(output); 431 psFree(where); 432 return false; 433 } 434 psFree(output); 435 psFree(where); 436 return true; 437 } 438 # endif 439 381 440 } 382 441 psFree(output); -
trunk/ippTools/src/stacktoolConfig.c
r24660 r24664 82 82 psMetadataAddS32(definebyqueryArgs, PS_LIST_TAIL, "-min_new", 0, "minimum number of new inputs", 0); 83 83 psMetadataAddF32(definebyqueryArgs, PS_LIST_TAIL, "-min_frac", 0, "minumum fraction of new inputs", NAN); 84 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-pretend", 0, "do not actually modify the database", false); 84 85 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 85 86
Note:
See TracChangeset
for help on using the changeset viewer.
