Changeset 10671 for trunk/ippTools/src/regtool.c
- Timestamp:
- Dec 12, 2006, 3:52:24 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/regtool.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/regtool.c
r10637 r10671 82 82 PS_ASSERT_PTR_NON_NULL(config, false); 83 83 84 bool status = false; 85 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 86 if (!status) { 87 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -limit"); 88 return false; 89 } 90 84 91 // return only exps that: 85 92 // are not in rawScienceExp … … 88 95 // and have no associated imfiles left in newImfile 89 96 90 char *query =97 psString query = psStringCopy( 91 98 "SELECT" 92 99 " newExp.*" … … 105 112 " (SELECT COUNT(exp_tag) FROM rawImfile" 106 113 " WHERE rawImfile.exp_tag = newExp.exp_tag)" 107 ; 114 ); 115 116 // treat limit == 0 as "no limit" 117 if (limit) { 118 psString limitString = psDBGenerateLimitSQL(limit); 119 psStringAppend(&query, " %s", limitString); 120 psFree(limitString); 121 } 108 122 109 123 if (!p_psDBRunQuery(config->dbh, query)) { 110 124 psError(PS_ERR_UNKNOWN, false, "database error"); 111 return false; 112 } 125 psFree(query); 126 return false; 127 } 128 psFree(query); 113 129 114 130 psArray *output = p_psDBFetchResult(config->dbh); … … 150 166 PS_ASSERT_PTR_NON_NULL(config, false); 151 167 168 bool status = false; 169 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 170 if (!status) { 171 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -limit"); 172 return false; 173 } 174 152 175 // select newImfiles that: 153 176 // exp_tag is in newExp … … 156 179 // XXX having the same exp_tag in newExp and raw*Exp is probably an error 157 180 // that should be checked for 158 char *query = 181 182 psString query = psStringCopy( 159 183 "SELECT newImfile.* FROM newImfile" 160 184 " LEFT JOIN newExp USING(exp_tag)" … … 163 187 " WHERE newExp.exp_tag is NOT NULL" 164 188 " AND rawScienceExp.exp_tag IS NULL" 165 " AND rawDetrendExp.exp_tag IS NULL"; 189 " AND rawDetrendExp.exp_tag IS NULL" 190 ); 191 192 // treat limit == 0 as "no limit" 193 if (limit) { 194 psString limitString = psDBGenerateLimitSQL(limit); 195 psStringAppend(&query, " %s", limitString); 196 psFree(limitString); 197 } 166 198 167 199 if (!p_psDBRunQuery(config->dbh, query)) { 168 200 psError(PS_ERR_UNKNOWN, false, "database error"); 169 return false; 170 } 201 psFree(query); 202 return false; 203 } 204 psFree(query); 171 205 172 206 psArray *output = p_psDBFetchResult(config->dbh);
Note:
See TracChangeset
for help on using the changeset viewer.
