Added auto reconnect option to database
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@3499 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
a3ba83aca4
commit
3aa6c13c64
|
@ -31,9 +31,12 @@ void zmDbConnect()
|
||||||
{
|
{
|
||||||
if ( !mysql_init( &dbconn ) )
|
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 ) );
|
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( ":/" );
|
std::string::size_type colonIndex = staticConfig.DB_HOST.find( ":/" );
|
||||||
if ( colonIndex != std::string::npos )
|
if ( colonIndex != std::string::npos )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue