Changeset 15032
- Timestamp:
- Sep 26, 2007, 11:13:41 AM (19 years ago)
- Location:
- trunk/ippTools/src
- Files:
-
- 2 edited
-
pztool.c (modified) (6 diffs)
-
pztoolConfig.c (modified) (3 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); -
trunk/ippTools/src/pztoolConfig.c
r14600 r15032 66 66 psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_type", 0, 67 67 "define exposure type", NULL); 68 psMetadataAddU64(pendingexpArgs, PS_LIST_TAIL, "-limit", 0, 69 "limit result set to N items", 0); 68 70 psMetadataAddBool(pendingexpArgs, PS_LIST_TAIL, "-simple", 0, 69 71 "use the simple output format", false); … … 79 81 psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_type", 0, 80 82 "define exposure type", NULL); 83 psMetadataAddU64(pendingimfileArgs, PS_LIST_TAIL, "-limit", 0, 84 "limit result set to N items", 0); 81 85 psMetadataAddBool(pendingimfileArgs, PS_LIST_TAIL, "-simple", 0, 82 86 "use the simple output format", false); … … 85 89 psMetadata *copydoneArgs = psMetadataAlloc(); 86 90 psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-exp_name", 0, 87 "define exposure ID ", NULL);91 "define exposure ID (required)", NULL); 88 92 psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-inst", 0, 89 "define camera ID ", NULL);93 "define camera ID (required)", NULL); 90 94 psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-telescope", 0, 91 "define telescope ID ", NULL);95 "define telescope ID (required)", NULL); 92 96 psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-class", 0, 93 97 "define class", NULL);
Note:
See TracChangeset
for help on using the changeset viewer.
