Made SQL buffers bigger to prevent overflow.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@588 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2003-07-03 20:39:47 +00:00
parent 1ea7b1cb38
commit 16d338b2ab
4 changed files with 10 additions and 10 deletions

View File

@ -32,7 +32,7 @@
Event::Event( Monitor *p_monitor, struct timeval p_start_time ) : monitor( p_monitor ), start_time( p_start_time )
{
static char sql[256];
static char sql[BUFSIZ];
static char start_time_str[32];
strftime( start_time_str, sizeof(start_time_str), "%Y-%m-%d %H:%M:%S", localtime( &start_time.tv_sec ) );
@ -63,7 +63,7 @@ Event::Event( Monitor *p_monitor, struct timeval p_start_time ) : monitor( p_mon
Event::~Event()
{
static char sql[256];
static char sql[BUFSIZ];
static char end_time_str[32];
struct DeltaTimeval delta_time;
@ -239,7 +239,7 @@ void Event::AddFrame( struct timeval timestamp, const Image *image, const Image
DELTA_TIMEVAL( delta_time, timestamp, start_time, DT_PREC_2 );
Debug( 1, ( "Adding frame %d to DB", frames ));
static char sql[256];
static char sql[BUFSIZ];
sprintf( sql, "insert into Frames ( EventId, FrameId, AlarmFrame, ImagePath, Delta, Score ) values ( %d, %d, %d, '%s', %s%ld.%02ld, %d )", id, frames, alarm_image!=0, event_file, delta_time.positive?"":"-", delta_time.sec, delta_time.fsec, score );
if ( mysql_query( &dbconn, sql ) )
{
@ -266,7 +266,7 @@ void Event::AddFrame( struct timeval timestamp, const Image *image, const Image
void Event::StreamEvent( const char *path, int event_id, long refresh, FILE *fd )
{
static char sql[256];
static char sql[BUFSIZ];
sprintf( sql, "select Id, EventId, ImagePath, Delta from Frames where EventId = %d order by Id", event_id );
if ( mysql_query( &dbconn, sql ) )
{

View File

@ -605,7 +605,7 @@ void Monitor::ReloadZones()
int Monitor::Load( int device, Monitor **&monitors, Mode mode )
{
static char sql[256];
static char sql[BUFSIZ];
if ( device == -1 )
{
strcpy( sql, "select Id, Name, Function+0, Device, Channel, Format, Width, Height, Palette, Orientation+0, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Function != 'None' and Type = 'Local'" );
@ -651,7 +651,7 @@ int Monitor::Load( int device, Monitor **&monitors, Mode mode )
int Monitor::Load( const char *host, const char*port, const char *path, Monitor **&monitors, Mode mode )
{
static char sql[256];
static char sql[BUFSIZ];
if ( !host )
{
strcpy( sql, "select Id, Name, Function+0, Host, Port, Path, Width, Height, Palette, Orientation+0, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Function != 'None' and Type = 'Remote'" );
@ -697,7 +697,7 @@ int Monitor::Load( const char *host, const char*port, const char *path, Monitor
Monitor *Monitor::Load( int id, bool load_zones, Mode mode )
{
static char sql[256];
static char sql[BUFSIZ];
sprintf( sql, "select Id, Name, Type, Function+0, Device, Channel, Format, Host, Port, Path, Width, Height, Palette, Orientation+0, LabelFormat, LabelX, LabelY, ImageBufferCount, WarmupCount, PreEventCount, PostEventCount, MaxFPS, FPSReportInterval, RefBlendPerc from Monitors where Id = %d", id );
if ( mysql_query( &dbconn, sql ) )
{

View File

@ -65,7 +65,7 @@ Zone::~Zone()
void Zone::RecordStats( const Event *event )
{
static char sql[256];
static char sql[BUFSIZ];
sprintf( sql, "insert into Stats set MonitorId=%d, ZoneId=%d, EventId=%d, FrameId=%d, AlarmPixels=%d, FilterPixels=%d, BlobPixels=%d, Blobs=%d, MinBlobSize=%d, MaxBlobSize=%d, MinX=%d, MinY=%d, MaxX=%d, MaxY=%d, Score=%d", monitor->Id(), id, event->Id(), event->Frames()+1, alarm_pixels, alarm_filter_pixels, alarm_blob_pixels, alarm_blobs, min_blob_size, max_blob_size, alarm_box.LoX(), alarm_box.LoY(), alarm_box.HiX(), alarm_box.HiY(), score );
if ( mysql_query( &dbconn, sql ) )
{
@ -394,7 +394,7 @@ bool Zone::CheckAlarms( const Image *delta_image )
int Zone::Load( Monitor *monitor, Zone **&zones )
{
static char sql[256];
static char sql[BUFSIZ];
sprintf( sql, "select Id,Name,Type+0,Units,LoX,LoY,HiX,HiY,AlarmRGB,AlarmThreshold,MinAlarmPixels,MaxAlarmPixels,FilterX,FilterY,MinFilterPixels,MaxFilterPixels,MinBlobPixels,MaxBlobPixels,MinBlobs,MaxBlobs from Zones where MonitorId = %d order by Type, Id", monitor->Id() );
if ( mysql_query( &dbconn, sql ) )
{

View File

@ -105,7 +105,7 @@ int main( int argc, char *argv[] )
// Only do registered devices
zmDbConnect( ZM_DB_USERA, ZM_DB_PASSA );
static char sql[256];
static char sql[BUFSIZ];
//sprintf( sql, "select distinct Device from Monitors where Function != 'None' and Type = 'Local'" );
sprintf( sql, "select distinct Device from Monitors where Type = 'Local'" );
if ( mysql_query( &dbconn, sql ) )