Changeset 15032 for trunk/ippTools/src/pztool.c
- Timestamp:
- Sep 26, 2007, 11:13:41 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/pztool.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/pztool.c
r14627 r15032 137 137 PS_ASSERT_PTR_NON_NULL(config, false); 138 138 139 bool status = false; 140 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 141 if (!status) { 142 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -limit"); 143 return false; 144 } 145 139 146 psString query = psStringCopy( 140 147 "SELECT" … … 151 158 } 152 159 160 // treat limit == 0 as "no limit" 161 if (limit) { 162 psString limitString = psDBGenerateLimitSQL(limit); 163 psStringAppend(&query, " %s", limitString); 164 psFree(limitString); 165 } 166 153 167 if (!p_psDBRunQuery(config->dbh, query)) { 154 168 psError(PS_ERR_UNKNOWN, false, "database error"); … … 196 210 PS_ASSERT_PTR_NON_NULL(config, false); 197 211 212 bool status = false; 213 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 214 if (!status) { 215 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -limit"); 216 return false; 217 } 218 198 219 psString query = psStringCopy( 199 220 "SELECT" … … 208 229 psStringAppend(&query, " AND %s", whereClause); 209 230 psFree(whereClause); 231 } 232 233 // treat limit == 0 as "no limit" 234 if (limit) { 235 psString limitString = psDBGenerateLimitSQL(limit); 236 psStringAppend(&query, " %s", limitString); 237 psFree(limitString); 210 238 } 211 239 … … 478 506 psS64 exp_id = psDBLastInsertID(config->dbh); 479 507 480 // insert new pzDoneImfileinto newImfile508 // insert new all pzDoneImfile for the exp into newImfile 481 509 { 482 510 char *query = … … 503 531 } 504 532 505 // sanity check: we should have inserted onlyone row533 // sanity check: we should have inserted at least one row 506 534 psU64 affected = psDBAffectedRows(config->dbh); 507 if (psDBAffectedRows(config->dbh) !=1) {535 if (psDBAffectedRows(config->dbh) < 1) { 508 536 // rollback 509 537 if (!psDBRollback(config->dbh)) { 510 538 psError(PS_ERR_UNKNOWN, false, "database error"); 511 539 } 512 psError(PS_ERR_UNKNOWN, false, "should have affected 1 row but %" PRIu64 " rows were modified", affected);540 psError(PS_ERR_UNKNOWN, false, "should have affected at least 1 row but %" PRIu64 " rows were modified", affected); 513 541 psFree(doneExp); 514 542 psFree(output);
Note:
See TracChangeset
for help on using the changeset viewer.
