Changeset 16613 for trunk/ippTools/src/dettool.c
- Timestamp:
- Feb 22, 2008, 10:23:58 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/dettool.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/dettool.c
r16504 r16613 1011 1011 1012 1012 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1013 1013 PXOPT_LOOKUP_BOOL(active, config->args, "-active", false); 1014 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 1015 1016 PXOPT_COPY_STR(config->args, config->where, "-inst", "camera", "=="); 1017 PXOPT_COPY_STR(config->args, config->where, "-telescope", "telescope", "=="); 1018 PXOPT_COPY_STR(config->args, config->where, "-filter", "filter", "=="); 1019 1020 // airmass_min < airmass < airmass_max 1021 PXOPT_COPY_F32(config->args, config->where, "-airmass", "airmass_min", "<="); 1022 PXOPT_COPY_F32(config->args, config->where, "-airmass", "airmass_max", ">="); 1023 1024 // exp_time_min < exp_time < exp_time_max 1025 PXOPT_COPY_F32(config->args, config->where, "-exp_time", "exp_time_min", "<="); 1026 PXOPT_COPY_F32(config->args, config->where, "-exp_time", "exp_time_max", ">="); 1027 1028 // ccd_temp_min < ccd_temp < ccd_temp_max 1029 PXOPT_COPY_F32(config->args, config->where, "-ccd_temp", "ccd_temp_min", "<="); 1030 PXOPT_COPY_F32(config->args, config->where, "-ccd_temp", "ccd_temp_max", ">="); 1031 1032 PXOPT_COPY_F64(config->args, config->where, "-posang", "posang_min", "<="); 1033 PXOPT_COPY_F64(config->args, config->where, "-posang", "posang_max", ">="); 1034 1035 psString query = pxDataGet("dettool_runs.sql"); 1036 if (!query) { 1037 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 1038 return false; 1039 } 1040 1041 if (config->where && active) { 1042 psString whereClause = psDBGenerateWhereSQL(config->where, "detRun"); 1043 psStringAppend(&query, " %s AND (detRun.state = 'run' OR detRun.state = 'stop' OR detRun.state = 'register')", whereClause); 1044 psFree(whereClause); 1045 } 1046 if (config->where && !active) { 1047 psString whereClause = psDBGenerateWhereSQL(config->where, "detRun"); 1048 psStringAppend(&query, " %s", whereClause); 1049 psFree(whereClause); 1050 } 1051 if (!config->where && active) { 1052 psStringAppend(&query, " WHERE (detRun.state = 'run' OR detRun.state = 'stop' OR detRun.state = 'register')"); 1053 } 1054 1055 // treat limit == 0 as "no limit" 1056 if (limit) { 1057 psString limitString = psDBGenerateLimitSQL(limit); 1058 psStringAppend(&query, " %s", limitString); 1059 psFree(limitString); 1060 } 1061 1062 if (!p_psDBRunQuery(config->dbh, query)) { 1063 psError(PS_ERR_UNKNOWN, false, "database error"); 1064 psFree(query); 1065 return false; 1066 } 1067 psFree(query); 1068 1069 psArray *runs = p_psDBFetchResult(config->dbh); 1070 if (!runs) { 1071 psError(PS_ERR_UNKNOWN, false, "database error"); 1072 return false; 1073 } 1074 1075 // XXX old version 1076 # if 0 1014 1077 // XXX fix the hard coding of the table name 1015 1078 psArray *runs = psDBSelectRows(config->dbh, "detRun", config->where, 0); … … 1018 1081 return false; 1019 1082 } 1083 # endif 1020 1084 1021 1085 if (!psArrayLength(runs)) {
Note:
See TracChangeset
for help on using the changeset viewer.
