output failing sql

This commit is contained in:
Isaac Connor 2017-10-08 09:13:56 -04:00
parent 7b7d477ab2
commit 219b7e0f36
1 changed files with 7 additions and 4 deletions

View File

@ -436,7 +436,10 @@ void Event::AddFramesInternal( int n_frames, int start_frame, Image **images, st
snprintf( event_file, sizeof(event_file), capture_file_format, path, frames ); snprintf( event_file, sizeof(event_file), capture_file_format, path, frames );
if ( monitor->GetOptSaveJPEGs() & 4 ) { if ( monitor->GetOptSaveJPEGs() & 4 ) {
//If this is the first frame, we should add a thumbnail to the event directory //If this is the first frame, we should add a thumbnail to the event directory
if(frames == 10){ // ICON: We are working through the pre-event frames so this snapshot won't
// neccessarily be of the motion. But some events are less than 10 frames,
// so I am changing this to 1, but we should overwrite it later with a better snapshot.
if ( frames == 1 ) {
char snapshot_file[PATH_MAX]; char snapshot_file[PATH_MAX];
snprintf( snapshot_file, sizeof(snapshot_file), "%s/snapshot.jpg", path ); snprintf( snapshot_file, sizeof(snapshot_file), "%s/snapshot.jpg", path );
WriteFrameImage( images[i], *(timestamps[i]), snapshot_file ); WriteFrameImage( images[i], *(timestamps[i]), snapshot_file );
@ -463,7 +466,7 @@ void Event::AddFramesInternal( int n_frames, int start_frame, Image **images, st
Debug( 1, "Adding %d/%d frames to DB", frameCount, n_frames ); Debug( 1, "Adding %d/%d frames to DB", frameCount, n_frames );
*(sql+strlen(sql)-2) = '\0'; *(sql+strlen(sql)-2) = '\0';
if ( mysql_query( &dbconn, sql ) ) { if ( mysql_query( &dbconn, sql ) ) {
Error( "Can't insert frames: %s", mysql_error( &dbconn ) ); Error( "Can't insert frames: %s, sql was (%s)", mysql_error( &dbconn ), sql );
exit( mysql_errno( &dbconn ) ); exit( mysql_errno( &dbconn ) );
} }
last_db_frame = frames; last_db_frame = frames;