Changeset 7972
- Timestamp:
- Jul 24, 2006, 5:50:02 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/pztool.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/pztool.c
r7970 r7972 136 136 for (long i = 0; i < pending->n; i++) { 137 137 pzPendingImfileRow *pendingImfile = pending->data[i]; 138 newImfileRow *newImfile = newImfileRowAlloc( 138 139 if (!newImfileInsert( 140 config->dbh, 139 141 pendingImfile->exp_id, 140 142 pendingImfile->class, 141 143 pendingImfile->class_id, 142 144 // XXX get this from the CLI 143 pendingImfile->uri 144 ); 145 146 if (!newImfileInsertObject(config->dbh, newImfile)) { 145 pendingImfile->uri) 146 ) { 147 147 psError(PS_ERR_UNKNOWN, false, "dbh access failed"); 148 psFree(newImfile); 149 return false; 150 } 151 152 psFree(newImfile); 153 } 154 155 if (pzPendingImfileDeleteRowObjects(config->dbh, pending, MAX_ROWS) 156 < 0) { 148 psFree(pending); 149 goto ROLLBACK; 150 } 151 } 152 153 if (pzPendingImfileDeleteRowObjects(config->dbh, pending, MAX_ROWS) < 0) { 157 154 psError(PS_ERR_UNKNOWN, false, "dbh access failed"); 158 155 psFree(pending); 159 return false;156 goto ROLLBACK; 160 157 } 161 158 psFree(pending); … … 164 161 if (!pzsearchFlushPendingExp(config)) { 165 162 psError(PS_ERR_UNKNOWN, false, "pzsearchFlushPendingExp() failed"); 166 return false;163 goto ROLLBACK; 167 164 } 168 165 … … 170 167 if (!psDBCommit(config->dbh)) { 171 168 psError(PS_ERR_UNKNOWN, false, "database error"); 172 return false; 173 } 174 175 return true; 169 // XXX is this the right thing to do after a commit failure? 170 goto ROLLBACK; 171 } 172 173 return true; 174 175 ROLLBACK: 176 // rollback 177 if (!psDBRollback(config->dbh)) { 178 psError(PS_ERR_UNKNOWN, false, "database error"); 179 } 180 181 return false; 176 182 } 177 183 … … 240 246 241 247 if (!pendingImfiles) { 242 // exp has no coresponding imfiles 248 // exp has no coresponding imfiles so we need to remove it from 249 // pzPendingExp and add it to newExp 250 251 if (!newExpInsert( 252 config->dbh, 253 pendingExp->exp_id, 254 pendingExp->camera, 255 pendingExp->telescope, 256 pendingExp->exp_type, 257 pendingExp->imfiles) 258 ) { 259 psError(PS_ERR_UNKNOWN, false, "dbh access failed"); 260 psFree(pending); 261 return false; 262 } 243 263 244 264 psArray *nukeMe = psArrayAlloc(1); … … 252 272 } 253 273 } 254 } 255 256 return true; 257 } 274 275 psFree(pendingImfiles); 276 } 277 278 return true; 279 }
Note:
See TracChangeset
for help on using the changeset viewer.
