From 3aa6c13c64b44f0cc0c9c512f59d39f46843c429 Mon Sep 17 00:00:00 2001 From: stan Date: Tue, 23 Aug 2011 13:31:04 +0000 Subject: [PATCH] Added auto reconnect option to database git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@3499 e3e1d417-86f3-4887-817a-d78f3d33393f --- src/zm_db.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/zm_db.cpp b/src/zm_db.cpp index a9f532b8a..26a33d6f5 100644 --- a/src/zm_db.cpp +++ b/src/zm_db.cpp @@ -31,9 +31,12 @@ void zmDbConnect() { if ( !mysql_init( &dbconn ) ) { - Error( "Can't initialise structure: %s", mysql_error( &dbconn ) ); + Error( "Can't initialise database connection: %s", mysql_error( &dbconn ) ); exit( mysql_errno( &dbconn ) ); } + my_bool reconnect = 1; + if ( mysql_options( &dbconn, MYSQL_OPT_RECONNECT, &reconnect ) ) + Fatal( "Can't set database auto reconnect option: %s", mysql_error( &dbconn ) ); std::string::size_type colonIndex = staticConfig.DB_HOST.find( ":/" ); if ( colonIndex != std::string::npos ) {