ensembl-hive  2.7.0
Bio::EnsEMBL::DBSQL::ProxyDBConnection Class Reference
+ Inheritance diagram for Bio::EnsEMBL::DBSQL::ProxyDBConnection:

Public Member Functions

public new ()
 
public switch_database ()
 
public check_reconnection ()
 
protected _last_used ()
 
protected _require_reconnect ()
 
public Int reconnect_interval ()
 
public String dbname ()
 
public sql_helper ()
 
protected __resolver ()
 
- Public Member Functions inherited from Bio::EnsEMBL::Utils::Proxy
public Bio::EnsEMBL::Utils::Proxy new ()
 
protected Any __proxy ()
 
public Boolean isa ()
 
public Code can ()
 
public void DESTROY ()
 
public void AUTOLOAD ()
 
protected __resolver ()
 

Detailed Description

Synopsis

my $dbc = Bio::EnsEMBL::DBSQL::DBConnection->new(-HOST => 'host', -PORT => 3306, -USER => 'user');
my $p_h_dbc = Bio::EnsEMBL::DBSQL::ProxyDBConnection->new(-DBC => $dbc, -DBNAME => 'human');
my $p_m_dbc = Bio::EnsEMBL::DBSQL::ProxyDBConnection->new(-DBC => $dbc, -DBNAME => 'mouse');
# With a 10 minute timeout reconnection in milliseconds
my $p_h_rc_dbc = Bio::EnsEMBL::DBSQL::ProxyDBConnection->new(-DBC => $dbc, -DBNAME => 'human', -RECONNECT_INTERVAL => (10*60*1000));

Description

This class is used to maintain one active connection to a database whilst it
appears to be working against multiple schemas. It does this by checking the
currently connected database before performing any query which could require
a database change such as prepare.

This class is only intended for internal use so please do not use unless
you are aware of what it will do and what the consequences of its usage are.

Definition at line 30 of file ProxyDBConnection.pm.

Member Function Documentation

◆ __resolver()

protected Bio::EnsEMBL::DBSQL::ProxyDBConnection::__resolver ( )

Undocumented method

Code:
click to view

◆ _last_used()

protected Bio::EnsEMBL::DBSQL::ProxyDBConnection::_last_used ( )

Undocumented method

Code:
click to view

◆ _require_reconnect()

protected Bio::EnsEMBL::DBSQL::ProxyDBConnection::_require_reconnect ( )

Undocumented method

Code:
click to view

◆ check_reconnection()

public Bio::EnsEMBL::DBSQL::ProxyDBConnection::check_reconnection ( )
  Description : Looks to see if the last time we used the backing DBI
                connection was greater than the reconnect_interval()
                provided at construction or runtime. If enought time has 
                elapsed then a reconnection is attempted. We do not
                attempt a reconnection if:
  • No reconnect_interval was set
  • The connection was not active
  Exceptions  : None apart from those raised from the reconnect() method
                from DBConnection
 
Code:
click to view

◆ dbname()

public String Bio::EnsEMBL::DBSQL::ProxyDBConnection::dbname ( )
    Arg[1]      : String DB name
  Description : Accessor for the name of the database we should use whenever
                a DBConnection request is made via this class
  Returntype  : String the name of the database which we should use
  Exceptions  : None
 
Code:
click to view

◆ new()

public Bio::EnsEMBL::DBSQL::ProxyDBConnection::new ( )

Undocumented method

Code:
click to view

◆ reconnect_interval()

public Int Bio::EnsEMBL::DBSQL::ProxyDBConnection::reconnect_interval ( )
    Arg[1]      : Integer reconnection interval in milliseconds
  Description : Accessor for the reconnection interval expressed in milliseconds
  Returntype  : Int miliseconds for a reconnection interval
 
Code:
click to view

◆ sql_helper()

public Bio::EnsEMBL::DBSQL::ProxyDBConnection::sql_helper ( )

Undocumented method

Code:
click to view

◆ switch_database()

public Bio::EnsEMBL::DBSQL::ProxyDBConnection::switch_database ( )
  Description : Performs a switch of the backing DBConnection if the currently
                connected database is not the same as the database this proxy
                wants to connect to. It currently supports MySQL, Oracle and
                Postges switches is untested with all bar MySQL. If it
                cannot do a live DB/schema switch then it will disconnect
                the connection and then wait for the next process to
                connect therefore switching the DB.
  Exceptions  : None but will warn if you attempt to switch a DB with 
                active kids attached to the proxied database handle.
 
Code:
click to view

The documentation for this class was generated from the following file:
Bio::EnsEMBL::DBSQL::ProxyDBConnection
Definition: ProxyDBConnection.pm:30
Bio::EnsEMBL::DBSQL::ProxyDBConnection::__resolver
protected __resolver()
Bio::EnsEMBL::DBSQL::ProxyDBConnection::check_reconnection
public check_reconnection()
Bio::EnsEMBL::DBSQL::ProxyDBConnection::new
public new()
Bio::EnsEMBL::DBSQL::ProxyDBConnection::dbname
public String dbname()
Bio::EnsEMBL::Utils::SqlHelper::new
public Instance new()
Bio::EnsEMBL::DBSQL::ProxyDBConnection::reconnect_interval
public Int reconnect_interval()
Bio::EnsEMBL::DBSQL::ProxyDBConnection::sql_helper
public sql_helper()
Bio::EnsEMBL::DBSQL::DBConnection
Definition: DBConnection.pm:42
Bio::EnsEMBL::DBSQL::ProxyDBConnection::_last_used
protected _last_used()
Bio::EnsEMBL::DBSQL::DBConnection::new
public Bio::EnsEMBL::DBSQL::DBConnection new()
Bio::EnsEMBL::Utils::SqlHelper
Definition: SqlHelper.pm:55
Bio::EnsEMBL::DBSQL::ProxyDBConnection::switch_database
public switch_database()
Bio::EnsEMBL::DBSQL::ProxyDBConnection::_require_reconnect
protected _require_reconnect()