Update Event details when writing Frame Data. Write Frame Details when inserting a Bulk Frame

This commit is contained in:
Isaac Connor 2020-10-07 18:37:38 -04:00
parent 044ce61ddb
commit 7cc023c1ec
1 changed files with 1 additions and 4 deletions

View File

@ -660,14 +660,11 @@ void Event::AddFrame(Image *image, struct timeval timestamp, int score, Image *a
static char sql[ZM_SQL_MED_BUFSIZ];
frame_data.push(new Frame(id, frames, frame_type, timestamp, delta_time, score));
if ( write_to_db || ( frame_data.size() > 20 ) ) {
if ( write_to_db || ( frame_data.size() > 20 ) || frame_type==BULK ) {
Debug(1, "Adding %d frames to DB", frame_data.size());
WriteDbFrames();
last_db_frame = frames;
}
// We are writing a Bulk frame
if ( frame_type == BULK ) {
snprintf(sql, sizeof(sql),
"UPDATE Events SET Length = %s%ld.%02ld, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d WHERE Id = %" PRIu64,
( delta_time.positive?"":"-" ),