Changeset 42412 for trunk/ippTools/src
- Timestamp:
- Mar 14, 2023, 3:31:02 PM (3 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 2 edited
-
pzgetexp.c (modified) (6 diffs)
-
pzgetexpConfig.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/pzgetexp.c
r42387 r42412 77 77 PXOPT_LOOKUP_S32(timeout, config->args, "-timeout", false, false); 78 78 PXOPT_LOOKUP_BOOL(all, config->args, "-all", false); 79 PXOPT_LOOKUP_BOOL(ignore_errors, config->args, "-ignore-errors", false); 79 80 80 81 // find last fileset/exp_name (if we have one) … … 180 181 } 181 182 183 // XXX for test, make this not a temporary table: 182 184 // create a temporry table 183 185 { … … 197 199 198 200 { 199 char *query = "INSERT INTO incoming (exp_name, camera, telescope, dateobs, exp_type, uri) VALUES (?, ?, ?, ?, ?, ?)"; 201 char *query_notice = "INSERT INTO incoming (exp_name, camera, telescope, dateobs, exp_type, uri) VALUES (?, ?, ?, ?, ?, ?)"; 202 char *query_ignore = "INSERT IGNORE INTO incoming (exp_name, camera, telescope, dateobs, exp_type, uri) VALUES (?, ?, ?, ?, ?, ?)"; 203 204 char *query = ignore_errors ? query_ignore : query_notice; 200 205 201 206 long inserted = p_psDBRunQueryPrepared(config->dbh, newSummitExps, query); … … 209 214 return false; 210 215 } 216 fprintf (stderr, "inserted: %d\n", (int) inserted); 211 217 // sanity check that we actually inserted something 212 218 if (inserted == 0) { … … 222 228 223 229 psFree(newSummitExps); 230 231 // TEST 232 if (0) { 233 char *query = "select * from incomingTest"; 234 p_psDBRunQuery(config->dbh, query); 235 psArray *output = p_psDBFetchResult(config->dbh); 236 if (!output) { 237 psError(PS_ERR_UNKNOWN, false, "database error"); 238 return false; 239 } 240 241 // negative simple so the default is true 242 if (!ippdbPrintMetadatas(stdout, output, "test", TRUE)) { 243 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 244 psFree(output); 245 return false; 246 } 247 psFree(output); 248 exit (2); 249 } 250 251 // debug this query 252 if (0) { 253 char *query = 254 "DESCRIBE INSERT INTO summitExp" 255 " SELECT" 256 " NULL," // summit_id 257 " incomingTest.*," 258 " NULL," // imfiles 259 " 0," // fault 260 " NULL" // epoch 261 " FROM incomingTest" 262 " LEFT JOIN summitExp" 263 " USING(exp_name, camera, telescope)" 264 " WHERE" 265 " summitExp.exp_name is NULL" 266 " AND summitExp.camera is NULL" 267 " AND summitExp.telescope is NULL"; 268 269 if (!p_psDBRunQuery(config->dbh, query)) { 270 // rollback 271 if (!psDBRollback(config->dbh)) { 272 psError(PS_ERR_UNKNOWN, false, "database error"); 273 } 274 psError(PS_ERR_UNKNOWN, false, "database error"); 275 return false; 276 } 277 psArray *output = p_psDBFetchResult(config->dbh); 278 if (!output) { 279 psError(PS_ERR_UNKNOWN, false, "database error"); 280 return false; 281 } 282 283 // negative simple so the default is true 284 if (!ippdbPrintMetadatas(stdout, output, "test", TRUE)) { 285 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 286 psFree(output); 287 return false; 288 } 289 psFree(output); 290 } 291 292 // exit (1); 224 293 225 294 // add new exps to summitExp … … 239 308 " summitExp.exp_name is NULL" 240 309 " AND summitExp.camera is NULL" 241 " AND summitExp.telescope is NULL"; 310 " AND summitExp.telescope is NULL"; 311 312 // MAJOR hack to avoid excess long inserts 313 // include this line to limit the incomping entries 314 // " AND incoming.dateobs > '2023-01-01'"; 242 315 243 316 if (!p_psDBRunQuery(config->dbh, query)) { -
trunk/ippTools/src/pzgetexpConfig.c
r18919 r42412 55 55 psMetadataAddBool(args, PS_LIST_TAIL, "-all", 0, 56 56 "download ALL filesets", 0); 57 psMetadataAddBool(args, PS_LIST_TAIL, "-ignore-errors", 0, 58 "do not fail if one of the entries raises a database error", 0); 57 59 58 60
Note:
See TracChangeset
for help on using the changeset viewer.
