Changeset 10025
- Timestamp:
- Nov 16, 2006, 3:03:45 PM (20 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/pztool.c
r9973 r10025 30 30 31 31 static bool seenMode(pxConfig *config); 32 static bool pendingMode(pxConfig *config); 32 static bool pendingExpMode(pxConfig *config); 33 static bool pendingImfileMode(pxConfig *config); 33 34 static bool copydoneMode(pxConfig *config); 34 35 35 static psArray *pztoolPendingExp(pxConfig *config);36 static psArray *pztoolPendingImfiles(pxConfig *config);37 static bool pztoolFlushPendingExp(pxConfig *config);36 //static psArray *pztoolPendingExp(pxConfig *config); 37 //static psArray *pztoolPendingImfiles(pxConfig *config); 38 //static bool pztoolFlushPendingExp(pxConfig *config); 38 39 39 40 # define MODECASE(caseName, func) \ … … 53 54 switch (config->mode) { 54 55 MODECASE(PZTOOL_MODE_SEEN, seenMode); 55 MODECASE(PZTOOL_MODE_PENDING, pendingMode); 56 MODECASE(PZTOOL_MODE_PENDINGEXP, pendingExpMode); 57 MODECASE(PZTOOL_MODE_PENDINGIMFILE, pendingImfileMode); 56 58 MODECASE(PZTOOL_MODE_COPYDONE, copydoneMode); 57 59 default: … … 62 64 pmConfigDone(); 63 65 psLibFinalize(); 64 65 66 66 67 exit(EXIT_SUCCESS); … … 78 79 PS_ASSERT_PTR_NON_NULL(config, false); 79 80 80 psString query = psStringCopy( 81 "SELECT" 82 " summitExp.*" 83 " FROM summitExp" 84 " LEFT JOIN newExp" 85 " USING(exp_id, camera, telescope)" 86 " WHERE" 87 " newExp.exp_id is NULL" 88 " AND newExp.camera IS NULL" 89 " AND newExp.telescope IS NULL" 90 ); 81 psString query = psStringCopy("SELECT * FROM summitExp"); 91 82 92 83 if (config->where) { … … 109 100 } 110 101 if (!psArrayLength(output)) { 111 psError(PS_ERR_UNKNOWN, false, "no newExprows found");102 psError(PS_ERR_UNKNOWN, false, "no rows found"); 112 103 psFree(output); 113 104 return true; … … 125 116 126 117 // negative simple so the default is true 127 if (!ippdbPrintMetadatas(stdout, output, " newExp", !simple)) {118 if (!ippdbPrintMetadatas(stdout, output, "summitExp", !simple)) { 128 119 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 129 120 psFree(output); … … 136 127 } 137 128 138 static bool pending Mode(pxConfig *config)129 static bool pendingExpMode(pxConfig *config) 139 130 { 140 131 PS_ASSERT_PTR_NON_NULL(config, false); 141 132 142 psArray *pending = pzPendingFrameSearch(config); 143 if (!pending) { 144 psError(PS_ERR_UNKNOWN, false, "no pzPendingFrames found"); 145 return false; 146 } 147 if (!pzPendingFramePrint(stdout, config, pending)) { 148 psError(PS_ERR_UNKNOWN, false, "pzPendingFramePrint() failed"); 149 return false; 150 } 133 psString query = psStringCopy( 134 "SELECT" 135 " summitExp.*" 136 " FROM pzPendingExp" 137 " JOIN summitExp" 138 " USING(exp_id, camera, telescope)" 139 ); 140 141 if (config->where) { 142 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "pzPendingExp"); 143 psStringAppend(&query, " AND %s", whereClause); 144 psFree(whereClause); 145 } 146 147 if (!p_psDBRunQuery(config->dbh, query)) { 148 psError(PS_ERR_UNKNOWN, false, "database error"); 149 psFree(query); 150 return false; 151 } 152 psFree(query); 153 154 psArray *output = p_psDBFetchResult(config->dbh); 155 if (!output) { 156 psError(PS_ERR_UNKNOWN, false, "database error"); 157 return false; 158 } 159 if (!psArrayLength(output)) { 160 psError(PS_ERR_UNKNOWN, false, "no rows found"); 161 psFree(output); 162 return true; 163 } 164 165 bool simple = false; 166 { 167 bool status = false; 168 simple = psMetadataLookupBool(&status, config->args, "-simple"); 169 if (!status) { 170 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 171 psFree(output); 172 return false; 173 } 174 } 175 176 // negative simple so the default is true 177 if (!ippdbPrintMetadatas(stdout, output, "summitExp", !simple)) { 178 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 179 psFree(output); 180 return false; 181 } 182 183 psFree(output); 151 184 152 185 return true; 153 186 } 154 187 188 static bool pendingImfileMode(pxConfig *config) 189 { 190 PS_ASSERT_PTR_NON_NULL(config, false); 191 192 psString query = psStringCopy( 193 "SELECT" 194 " summitImfile.*" 195 " FROM pzPendingImfile" 196 " JOIN summitImfile" 197 " USING(exp_id, camera, telescope, class, class_id)" 198 ); 199 200 if (config->where) { 201 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "pzPendingImfile"); 202 psStringAppend(&query, " AND %s", whereClause); 203 psFree(whereClause); 204 } 205 206 if (!p_psDBRunQuery(config->dbh, query)) { 207 psError(PS_ERR_UNKNOWN, false, "database error"); 208 psFree(query); 209 return false; 210 } 211 psFree(query); 212 213 psArray *output = p_psDBFetchResult(config->dbh); 214 if (!output) { 215 psError(PS_ERR_UNKNOWN, false, "database error"); 216 return false; 217 } 218 if (!psArrayLength(output)) { 219 psError(PS_ERR_UNKNOWN, false, "no rows found"); 220 psFree(output); 221 return true; 222 } 223 224 bool simple = false; 225 { 226 bool status = false; 227 simple = psMetadataLookupBool(&status, config->args, "-simple"); 228 if (!status) { 229 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 230 psFree(output); 231 return false; 232 } 233 } 234 235 // negative simple so the default is true 236 if (!ippdbPrintMetadatas(stdout, output, "summitImfile", !simple)) { 237 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 238 psFree(output); 239 return false; 240 } 241 242 psFree(output); 243 244 return true; 245 } 246 155 247 static bool copydoneMode(pxConfig *config) 156 248 { 157 249 PS_ASSERT_PTR_NON_NULL(config, false); 158 250 251 #if 0 159 252 // we don't have to operate on complete frames here as it's ok to start 160 253 // downloading the imfiles before the exp has been registered … … 178 271 if (!newImfileInsert( 179 272 config->dbh, 180 pendingImfile->exp_ id,273 pendingImfile->exp_tag, 181 274 pendingImfile->class, 182 pendingImfile->class_id, 275 pendingImfile->class_id 276 ) 183 277 // XXX get this from the CLI 184 pendingImfile->uri) 278 // pendingImfile->uri 185 279 ) { 186 280 psError(PS_ERR_UNKNOWN, false, "dbh access failed"); … … 217 311 psError(PS_ERR_UNKNOWN, false, "database error"); 218 312 } 313 #endif 219 314 220 315 return false; 221 316 } 222 317 318 #if 0 223 319 static psArray *pztoolPendingExp(pxConfig *config) 224 320 { … … 302 398 return true; 303 399 } 400 401 #endif -
trunk/ippTools/src/pztool.h
r9392 r10025 26 26 PZTOOL_MODE_NONE = 0x0, 27 27 PZTOOL_MODE_SEEN, 28 PZTOOL_MODE_PENDING, 28 PZTOOL_MODE_PENDINGEXP, 29 PZTOOL_MODE_PENDINGIMFILE, 29 30 PZTOOL_MODE_COPYDONE 30 31 } pztoolMode; -
trunk/ippTools/src/pztoolConfig.c
r9973 r10025 53 53 "use the simple output format", false); 54 54 55 // -pending 56 psMetadata *pending Args = psMetadataAlloc();57 psMetadataAddStr(pending Args, PS_LIST_TAIL, "-exp_tag", 0,58 "define exposure ID", NULL); 59 psMetadataAddStr(pending Args, PS_LIST_TAIL, "-inst", 0,55 // -pendingexp 56 psMetadata *pendingexpArgs = psMetadataAlloc(); 57 psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_tag", 0, 58 "define exposure ID", NULL); 59 psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-inst", 0, 60 60 "define camera ID", NULL); 61 psMetadataAddStr(pending Args, PS_LIST_TAIL, "-telescope", 0,61 psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-telescope", 0, 62 62 "define telescope ID", NULL); 63 psMetadataAddStr(pending Args, PS_LIST_TAIL, "-exp_type", 0,63 psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_type", 0, 64 64 "define exposure type", NULL); 65 psMetadataAddBool(pendingexpArgs, PS_LIST_TAIL, "-simple", 0, 66 "use the simple output format", false); 67 68 // -pendingimfile 69 psMetadata *pendingimfileArgs = psMetadataAlloc(); 70 psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_tag", 0, 71 "define exposure ID", NULL); 72 psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-inst", 0, 73 "define camera ID", NULL); 74 psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-telescope", 0, 75 "define telescope ID", NULL); 76 psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_type", 0, 77 "define exposure type", NULL); 78 psMetadataAddBool(pendingimfileArgs, PS_LIST_TAIL, "-simple", 0, 79 "use the simple output format", false); 65 80 66 81 // -copydone … … 96 111 // find which mode we're running under 97 112 PXTOOL_MODE("-seen", PZTOOL_MODE_SEEN, seenArgs); 98 PXTOOL_MODE("-pending", PZTOOL_MODE_PENDING, pendingArgs); 113 PXTOOL_MODE("-pendingexp", PZTOOL_MODE_PENDINGEXP, pendingexpArgs); 114 PXTOOL_MODE("-pendingimfile", PZTOOL_MODE_PENDINGIMFILE,pendingimfileArgs); 99 115 PXTOOL_MODE("-copydone", PZTOOL_MODE_COPYDONE, copydoneArgs); 100 116
Note:
See TracChangeset
for help on using the changeset viewer.
