- Timestamp:
- Jul 21, 2008, 12:12:59 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080719/ippTools/src/dettool_residimfile.c
r18641 r18643 258 258 return true; 259 259 } 260 261 bool pendingcleanup_residimfileMode(pxConfig *config) 262 { 263 PS_ASSERT_PTR_NON_NULL(config, NULL); 264 265 PXOPT_LOOKUP_S64(chip_id, config->args, "-chip_id", false, false); 266 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 267 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 268 269 psMetadata *where = psMetadataAlloc(); 270 if (chip_id) { 271 PXOPT_COPY_S64(config->args, where, "-chip_id", "chip_id", "=="); 272 } 273 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); 274 275 psString query = pxDataGet("dettool_pendingcleanup_residimfile.sql"); 276 if (!query) { 277 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 278 return false; 279 } 280 281 if (where && psListLength(where->list)) { 282 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 283 psStringAppend(&query, " AND %s", whereClause); 284 psFree(whereClause); 285 } 286 psFree(where); 287 288 // treat limit == 0 as "no limit" 289 if (limit) { 290 psString limitString = psDBGenerateLimitSQL(limit); 291 psStringAppend(&query, " %s", limitString); 292 psFree(limitString); 293 } 294 295 if (!p_psDBRunQuery(config->dbh, query)) { 296 psError(PS_ERR_UNKNOWN, false, "database error"); 297 psFree(query); 298 return false; 299 } 300 psFree(query); 301 302 psArray *output = p_psDBFetchResult(config->dbh); 303 if (!output) { 304 psError(PS_ERR_UNKNOWN, false, "database error"); 305 return false; 306 } 307 if (!psArrayLength(output)) { 308 psTrace("dettool", PS_LOG_INFO, "no rows found"); 309 psFree(output); 310 return true; 311 } 312 313 // negative simple so the default is true 314 if (!ippdbPrintMetadatas(stdout, output, "detPendingCleanup_residimfile", !simple)) { 315 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 316 psFree(output); 317 return false; 318 } 319 320 psFree(output); 321 322 return true; 323 } 324 325 326 bool donecleanup_residimfileMode(pxConfig *config) 327 { 328 PS_ASSERT_PTR_NON_NULL(config, NULL); 329 330 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 331 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 332 333 psMetadata *where = psMetadataAlloc(); 334 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); 335 336 psString query = pxDataGet("dettool_donecleanup_residimfile.sql"); 337 if (!query) { 338 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 339 return false; 340 } 341 342 if (where && psListLength(where->list)) { 343 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 344 psStringAppend(&query, " AND %s", whereClause); 345 psFree(whereClause); 346 } 347 psFree(where); 348 349 // treat limit == 0 as "no limit" 350 if (limit) { 351 psString limitString = psDBGenerateLimitSQL(limit); 352 psStringAppend(&query, " %s", limitString); 353 psFree(limitString); 354 } 355 356 if (!p_psDBRunQuery(config->dbh, query)) { 357 psError(PS_ERR_UNKNOWN, false, "database error"); 358 psFree(query); 359 return false; 360 } 361 psFree(query); 362 363 psArray *output = p_psDBFetchResult(config->dbh); 364 if (!output) { 365 psError(PS_ERR_UNKNOWN, false, "database error"); 366 return false; 367 } 368 if (!psArrayLength(output)) { 369 psTrace("dettool", PS_LOG_INFO, "no rows found"); 370 psFree(output); 371 return true; 372 } 373 374 // negative simple so the default is true 375 if (!ippdbPrintMetadatas(stdout, output, "detDoneCleanup_residimfile", !simple)) { 376 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 377 psFree(output); 378 return false; 379 } 380 381 psFree(output); 382 383 return true; 384 } 385
Note:
See TracChangeset
for help on using the changeset viewer.
