Changeset 32422 for trunk/ippTools/src/laptool.c
- Timestamp:
- Sep 21, 2011, 11:11:16 AM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/laptool.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/laptool.c
r31827 r32422 30 30 static bool updateexpMode(pxConfig *config); 31 31 32 static bool diffcheckMode(pxConfig *config); 33 32 34 static bool inactiveexpMode(pxConfig *config); 33 35 … … 62 64 MODECASE(LAPTOOL_MODE_UPDATEEXP, updateexpMode); 63 65 66 MODECASE(LAPTOOL_MODE_DIFFCHECK, diffcheckMode); 67 64 68 MODECASE(LAPTOOL_MODE_INACTIVEEXP, inactiveexpMode); 65 69 default: … … 276 280 PXOPT_COPY_STR(config->args, where, "-filter", "rawExp.filter", "=="); 277 281 282 psMetadata *chipWhere = psMetadataAlloc(); 283 PXOPT_COPY_S64(config->args, chipWhere, "-seq_id", "lapRun.seq_id", "=="); 284 278 285 // This seems unnecessarily clunky. 279 286 if (!all_obsmode) { … … 296 303 } 297 304 305 psString chipWhereClause = psDBGenerateWhereConditionSQL(chipWhere,NULL); 298 306 if (whereClause) { 299 307 psStringSubstitute(&query,whereClause,"@WHERE@"); 300 308 } 309 if (chipWhereClause) { 310 psStringSubstitute(&query,chipWhereClause,"@CHIPWHERE@"); 311 } 301 312 psFree(where); 313 psFree(chipWhere); 302 314 303 315 // Fetch exposures … … 755 767 } 756 768 757 758 769 static bool diffcheckMode(pxConfig *config) 770 { 771 PS_ASSERT_PTR_NON_NULL(config, false); 772 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 773 774 psMetadata *where = psMetadataAlloc(); 775 PXOPT_COPY_S64(config->args, where, "-lap_id", "lapRun.lap_id", "=="); 776 PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "=="); 777 PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "=="); 778 PXOPT_COPY_S64(config->args, where, "-warp_id", "warp_id", "=="); 779 PXOPT_COPY_S64(config->args, where, "-seq_id", "seq_id", "=="); 780 PXOPT_COPY_STR(config->args, where, "-skycell_id", "skycell_id", "=="); 781 782 psString query = pxDataGet("laptool_WSdiff_check.sql"); 783 if (!query) { 784 psError(PXTOOLS_ERR_SYS, false, "failed to retrieve SQL statement"); 785 return(false); 786 } 787 788 if (psListLength(where->list)) { 789 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 790 psStringPrepend(&whereClause, "\n AND "); 791 psStringSubstitute(&query,whereClause,"@WHERE@"); 792 psFree(whereClause); 793 } 794 795 if (!p_psDBRunQuery(config->dbh, query)) { 796 psError(PS_ERR_UNKNOWN, false, "database error"); 797 psFree(query); 798 return false; 799 } 800 psFree(query); 801 802 psArray *output = p_psDBFetchResult(config->dbh); 803 if (!output) { 804 psErrorCode err = psErrorCodeLast(); 805 switch (err) { 806 case PS_ERR_DB_CLIENT: 807 psError(PXTOOLS_ERR_SYS, false, "database error"); 808 case PS_ERR_DB_SERVER: 809 psError(PXTOOLS_ERR_PROG, false, "database error"); 810 default: 811 psError(PXTOOLS_ERR_PROG, false, "unknown error %d",err); 812 } 813 814 return false; 815 } 816 if (!psArrayLength(output)) { 817 psTrace("laptool", PS_LOG_INFO, "no rows found"); 818 psFree(output); 819 return true; 820 } 821 822 if (psArrayLength(output)) { 823 if (!ippdbPrintMetadatas(stdout, output, "lapRunWarpStackSkycells", !simple)) { 824 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 825 psFree(output); 826 return false; 827 } 828 } 829 830 psFree(output); 831 return(true); 832 } 759 833 760 834 static bool inactiveexpMode(pxConfig *config)
Note:
See TracChangeset
for help on using the changeset viewer.
