Changeset 35777 for trunk/Ohana
- Timestamp:
- Jul 5, 2013, 5:59:12 PM (13 years ago)
- Location:
- trunk/Ohana/src/dvopsps/src
- Files:
-
- 2 edited
-
insert_detections_dvopsps.c (modified) (3 diffs)
-
insert_detections_dvopsps_catalog.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps.c
r35416 r35777 233 233 234 234 int status = TRUE; 235 int Ninsert = 0; 235 236 236 237 gettimeofday (&start, (void *) NULL); … … 239 240 // XXX check return status 240 241 insert_detections_mysql_detvalue (&buffer, &detections[i]); 242 Ninsert ++; 241 243 if (buffer.Nbuffer > MAX_BUFFER) { 242 244 if (!insert_detections_mysql_commit (&buffer, mysql)) { … … 247 249 bzero (buffer.buffer, buffer.Nalloc); 248 250 insert_detections_mysql_init (&buffer); 249 } 250 } 251 if (!insert_detections_mysql_commit (&buffer, mysql)) { 252 fprintf (stderr, "failure to insert detections in mysql (commit 2)\n"); 253 status = FALSE; 251 Ninsert = 0; 252 } 253 } 254 if (Ninsert > 0) { 255 // insert the remaining detections loaded in the buffer 256 if (!insert_detections_mysql_commit (&buffer, mysql)) { 257 fprintf (stderr, "failure to insert detections in mysql (commit 2)\n"); 258 status = FALSE; 259 } 254 260 } 255 261 FreeIOBuffer (&buffer); -
trunk/Ohana/src/dvopsps/src/insert_detections_dvopsps_catalog.c
r35578 r35777 104 104 insert_detections_mysql_init (&buffer); 105 105 int Ninsert = 0; 106 int Ntotal = 0; 106 107 107 108 int status = TRUE; … … 125 126 status = FALSE; 126 127 } 128 Ninsert ++; 129 Ntotal ++; 127 130 128 131 if (buffer.Nbuffer > MAX_BUFFER) { … … 141 144 insert_detections_mysql_init (&buffer); 142 145 } 143 144 Ninsert ++;145 146 found ++; 146 147 } 147 148 } 148 if (!insert_detections_mysql_commit (&buffer, mysql)) { 149 fprintf (stderr, "failure to insert detections in mysql (commit)\n"); 150 status = FALSE; 149 if (Ninsert > 0) { 150 // insert the remaining detections loaded in the buffer 151 if (!insert_detections_mysql_commit (&buffer, mysql)) { 152 fprintf (stderr, "failure to insert detections in mysql (commit)\n"); 153 status = FALSE; 154 } 151 155 } 152 156 153 if (VERBOSE) fprintf (stderr, "inserted %d rows\n", N insert);157 if (VERBOSE) fprintf (stderr, "inserted %d rows\n", Ntotal); 154 158 FreeIOBuffer (&buffer); 155 159 … … 169 173 } 170 174 171 PrintIOBuffer (buffer, "INSERT INTO dvoDetectionFull (imageID, ippDetectID, detectID, ippObjID, objID, photcode, flags, zp, zpErr, airMass, expTime, ra, dec_, raErr, decErr) VALUES \n"); 175 // PrintIOBuffer (buffer, "INSERT INTO dvoDetectionFull (imageID, ippDetectID, detectID, ippObjID, objID, photcode, flags, zp, zpErr, airMass, expTime, ra, dec_, raErr, decErr) VALUES \n"); 176 PrintIOBuffer (buffer, "INSERT INTO dvoDetectionFull (imageID, ippDetectID, detectID, ippObjID, objID, flags, zp, zpErr, airMass, expTime, ra, dec_, raErr, decErr) VALUES \n"); 172 177 173 178 return TRUE; … … 188 193 // ((uint64_t)average->catID << 32) + (uint64_t)average->objID, // ippObjID 189 194 PrintIOBuffer (buffer, "%lu, ", average->extID); // objID 190 PrintIOBuffer (buffer, "%d, ", measure->photcode); // photcode195 // XXX PrintIOBuffer (buffer, "%d, ", measure->photcode); // photcode 191 196 PrintIOBuffer (buffer, "%u, ", measure->dbFlags); // flags 192 197 … … 221 226 } else { 222 227 fprintf (stderr, "invalid sql?\n"); 228 int Nstart = MAX(0, buffer->Nbuffer - 3000); 229 fprintf (stderr, "buffer: ...%s...\n", &buffer->buffer[Nstart]); 223 230 return FALSE; 224 231 }
Note:
See TracChangeset
for help on using the changeset viewer.
