Changeset 24664 for trunk/ippTools/src/stacktool.c
- Timestamp:
- Jul 3, 2009, 11:48:59 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/stacktool.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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);
Note:
See TracChangeset
for help on using the changeset viewer.
