Commit 8439a28d authored by Jessica Severin's avatar Jessica Severin
Browse files

extended paramters to ->fetch() method to allow specifying default type.

If type is defined in url string, that will take precedence.
Bio::EnsEMBL::Hive::URLFactory->fetch($url, 'compara'); #defaults to compara DBA
Bio::EnsEMBL::Hive::URLFactory->fetch($url); #defaults to hive DBA
parent 984517ab
......@@ -77,12 +77,13 @@ sub fetch
{
my $class = shift;
my $url = shift;
my $type = shift;
return undef unless($url);
new Bio::EnsEMBL::Hive::URLFactory; #make sure global instance is created
my ($dba, $path) = $class->_get_db_connection($url);
my ($dba, $path) = $class->_get_db_connection($url, $type);
return $dba unless($path);
......@@ -127,6 +128,7 @@ sub _get_db_connection
#e.g. mysql://ensadmin:<pass>@ecs2:3362/ensembl_core_homo_sapiens_22_34;type=core
my $class = shift;
my $url = shift;
my $type = shift;
return undef unless($url);
......@@ -137,7 +139,7 @@ sub _get_db_connection
my $dbname = undef;
my $path = '';
my $module = "Bio::EnsEMBL::Hive::DBSQL::DBAdaptor";
my $type = 'hive';
$type = 'hive' unless($type);
my ($p, $p2, $p3);
#print("FETCH $url\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment