- Timestamp:
- Mar 30, 2011, 9:36:02 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213/ippTools/src
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
pzgetimfiles.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/ippTools/src
- Property svn:mergeinfo changed
/trunk/ippTools/src merged: 30854,30877,30906-30907,30912,30927,30945,31038,31045,31047,31051,31058
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20110213/ippTools/src/pzgetimfiles.c
r21402 r31083 99 99 int status = pclose(output); 100 100 101 // We have an id value now, let's get it and use it 102 char *id_query = "SELECT summit_id FROM summitExp WHERE exp_name = '%s' AND camera = '%s' AND telescope = '%s'"; 103 104 if (!p_psDBRunQueryF(config->dbh, id_query, filesetid, camera, telescope)) { 105 psError(PS_ERR_UNKNOWN, false, "database error"); 106 return false; 107 } 108 109 psArray *id_output = p_psDBFetchResult(config->dbh); 110 if (!id_output) { 111 psError(PS_ERR_UNKNOWN, false, "database error"); 112 return false; 113 } 114 if (psArrayLength(id_output) != 1) { 115 psError(PS_ERR_UNKNOWN, false, "database error: incorrect number of results"); 116 return false; 117 } 118 119 psMetadata *id_result = id_output->data[0]; 120 121 psS64 summit_id = psMetadataLookupS64(NULL, id_result, "summit_id"); 122 psFree(id_output); 123 // End of summit_id block. 124 101 125 if (status != 0) { 102 126 // mark the summitExp row as faulted 103 if (!p_psDBRunQueryF(config->dbh, "UPDATE summitExp SET fault = %d WHERE exp_name = '%s' AND camera = '%s' AND telescope = '%s'", WEXITSTATUS(status), filesetid, camera, telescope)) {127 if (!p_psDBRunQueryF(config->dbh, "UPDATE summitExp SET fault = %d WHERE summit_id = %ld", WEXITSTATUS(status), summit_id)) { 104 128 psError(PS_ERR_UNKNOWN, false, "database error"); 105 129 } … … 117 141 // download an "empty" fileset. 118 142 // mark the summitExp row as faulted 119 if (!p_psDBRunQueryF(config->dbh, "UPDATE summitExp SET fault = %d WHERE exp_name = '%s' AND camera = '%s' AND telescope = '%s'", 250, filesetid, camera, telescope)) {143 if (!p_psDBRunQueryF(config->dbh, "UPDATE summitExp SET fault = %d WHERE summit_id = %ld", 250, summit_id)) { 120 144 psError(PS_ERR_UNKNOWN, false, "database error"); 121 145 } … … 142 166 "UPDATE summitExp" 143 167 " SET imfiles = %d" 144 " WHERE exp_name = '%s'" 145 " AND camera = '%s'" 146 " AND telescope = '%s'"; 147 if (!p_psDBRunQueryF(config->dbh, query, imfiles, filesetid, camera, telescope)) { 168 " WHERE summit_id = %ld"; 169 if (!p_psDBRunQueryF(config->dbh, query, imfiles, summit_id)) { 148 170 // rollback 149 171 if (!psDBRollback(config->dbh)) { … … 159 181 "DELETE FROM pzDownloadExp" 160 182 " WHERE" 161 " exp_name = '%s'" 162 " AND camera = '%s'" 163 " AND telescope = '%s'"; 164 if (!p_psDBRunQueryF(config->dbh, query, filesetid, camera, telescope)) { 183 " summit_id = %ld"; 184 if (!p_psDBRunQueryF(config->dbh, query, summit_id)) { 165 185 // rollback 166 186 if (!psDBRollback(config->dbh)) { … … 245 265 "INSERT IGNORE INTO summitImfile" 246 266 " SELECT" 267 " %ld," // summit_id 247 268 " incoming.exp_name," 248 269 " incoming.camera," … … 256 277 " NULL" // epoch 257 278 " FROM incoming"; 258 if (!p_psDBRunQuery (config->dbh, query)) {279 if (!p_psDBRunQueryF(config->dbh, query,summit_id)) { 259 280 // rollback 260 281 if (!psDBRollback(config->dbh)) { … … 272 293 " SET imfiles = (SELECT COUNT(*) FROM summitImfile" 273 294 " WHERE" 274 " exp_name = '%s'" 275 " AND camera = '%s'" 276 " AND telescope = '%s'" 295 " summit_id = %ld" 277 296 ")" 278 297 " WHERE" 279 " exp_name = '%s'" 280 " AND camera = '%s'" 281 " AND telescope = '%s'" 298 " summit_id = %ld" 282 299 " AND imfiles IS NULL"; 283 if (!p_psDBRunQueryF(config->dbh, query, filesetid, camera, telescope, filesetid, camera, telescope)) {300 if (!p_psDBRunQueryF(config->dbh, query, summit_id, summit_id)) { 284 301 // rollback 285 302 if (!psDBRollback(config->dbh)) { … … 308 325 "INSERT IGNORE INTO pzDownloadExp" 309 326 " SELECT" 327 " %ld," // summit_id 310 328 " incoming.exp_name," 311 329 " incoming.camera," … … 319 337 " incoming.telescope"; 320 338 321 if (!p_psDBRunQuery (config->dbh, query)) {339 if (!p_psDBRunQueryF(config->dbh, query,summit_id)) { 322 340 // rollback 323 341 if (!psDBRollback(config->dbh)) {
Note:
See TracChangeset
for help on using the changeset viewer.
