Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl
Commits
dbd88e32
Commit
dbd88e32
authored
20 years ago
by
Ian Longden
Browse files
Options
Downloads
Patches
Plain Diff
dnadb taken out of dbconnection
parent
8cfc4d03
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/Bio/EnsEMBL/DBSQL/DBAdaptor.pm
+42
-29
42 additions, 29 deletions
modules/Bio/EnsEMBL/DBSQL/DBAdaptor.pm
modules/Bio/EnsEMBL/DBSQL/DBConnection.pm
+8
-16
8 additions, 16 deletions
modules/Bio/EnsEMBL/DBSQL/DBConnection.pm
with
50 additions
and
45 deletions
modules/Bio/EnsEMBL/DBSQL/DBAdaptor.pm
+
42
−
29
View file @
dbd88e32
...
...
@@ -67,7 +67,11 @@ my $reg = "Bio::EnsEMBL::Registry";
-driver => 'mysql' );
Exmaple2 : $db = new Bio::EnsEMBL::DBSQL::DBAdaptor(
-species => 'Homo_sapiens',
-group => 'core');
-group => 'core'
-user => 'root',
-dbname => 'pog',
-host => 'caldy',
-driver => 'mysql');
Description: Constructor for DBAdaptor.
Returntype : Bio::EnsEMBL::DBSQL::DBAdaptor
Exceptions : none
...
...
@@ -88,6 +92,7 @@ sub new {
rearrange
([
qw(SPECIES GROUP DBCONN DNADB)
],
@args
);
if
(
defined
(
$con
)){
$self
->
dbc
(
$con
);
}
else
{
...
...
@@ -104,7 +109,7 @@ sub new {
$self
->
group
(
$group
);
}
Bio::EnsEMBL::Utils::ConfigRegistry::
gen_load
(
$self
);
$self
=
Bio::EnsEMBL::Utils::ConfigRegistry::
gen_load
(
$self
);
if
(
defined
$dnadb
)
{
$self
->
dnadb
(
$dnadb
);
...
...
@@ -113,35 +118,35 @@ sub new {
return
$self
;
}
=head2 new_fast
#
=head2 new_fast
Arg [-CON]: Bio::EnsEMBL::DBSQL::DBConnection
#
Arg [-CON]: Bio::EnsEMBL::DBSQL::DBConnection
Exmaple : $db = new Bio::EnsEMBL::DBSQL::DBAdaptor( -con => $dbc);
Description: Constructor for DBAdaptor.
Returntype : Bio::EnsEMBL::DBSQL::DBAdaptor
Exceptions : none
Caller : general
#
Exmaple : $db = new Bio::EnsEMBL::DBSQL::DBAdaptor( -con => $dbc);
#
Description: Constructor for DBAdaptor.
#
Returntype : Bio::EnsEMBL::DBSQL::DBAdaptor
#
Exceptions : none
#
Caller : general
=cut
#
=cut
sub
new_fast
{
my
(
$class
,
@args
)
=
@_
;
my
(
$con
)
=
rearrange
([
qw(CON)
],
@args
);
#
sub new_fast{
#
my($class, @args) = @_;
#
my ( $con ) = rearrange([qw(CON)],@args);
#call superclass constructor
my
$self
=
{};
bless
$self
,
$class
;
unless
(
$con
&&
ref
$con
&&
$con
->
isa
('
Bio::EnsEMBL::DBSQL::DBConnection
'))
{
throw
("
$con
passed is not of type Bio::EnsEMBL::DBSQL::DBConnection
");
}
$self
->
dbc
(
$con
);
$self
->
species
(
$con
->
species
());
$self
->
group
(
$con
->
group
());
#
#call superclass constructor
#
my $self ={};
#
bless $self,$class;
#
unless($con && ref $con &&
#
$con->isa('Bio::EnsEMBL::DBSQL::DBConnection')) {
#
throw("$con passed is not of type Bio::EnsEMBL::DBSQL::DBConnection");
#
}
#
$self->dbc($con);
#
$self->species($con->species());
#
$self->group($con->group());
return
$self
;
}
#
return $self;
#
}
sub
new_merged
{
...
...
@@ -171,10 +176,18 @@ sub new_merged{
=cut
sub
dbc
{
my
(
$self
,
$arg
)
=
@_
;
(
defined
$arg
)
&&
(
$self
->
{
_dbc
}
=
$arg
);
$self
->
{
_dbc
};
my
$self
=
shift
;
if
(
@
_
){
my
$arg
=
shift
;
if
(
defined
(
$arg
)){
if
(
!
$arg
->
isa
('
Bio::EnsEMBL::DBSQL::DBConnection
')){
throw
("
$arg
is no a DBConnection
\n
");
}
}
$self
->
{
_dbc
}
=
$arg
;
}
return
$self
->
{
_dbc
};
}
=head2 db
...
...
This diff is collapsed.
Click to expand it.
modules/Bio/EnsEMBL/DBSQL/DBConnection.pm
+
8
−
16
View file @
dbd88e32
...
...
@@ -84,19 +84,12 @@ use Bio::EnsEMBL::Utils::Argument qw(rearrange);
which would otherwise keep open a lot of connections to the
database. Database connections are automatically reopened
when required.
Arg [DNADB] : (optional) Bio::EnsEMBL::DBSQL::DBConnection
The dbconnection to get the dna from.
Arg [SPECIES]: (optional) string
Name of the species to be labelled as.
Arg [GROUP]: (optional) string
Name of the group to be labelled as. (e.g. core, estgene, vega etc)
Example : $dbc = Bio::EnsEMBL::DBSQL::DBConnection->new
(-user => 'anonymous',
-dbname => 'homo_sapiens_core_20_34c',
-host => 'ensembldb.ensembl.org',
-driver => 'mysql'
-species => 'Homo Sapiens',
-group => 'core');
-driver => 'mysql');
Description: Constructor for a DatabaseConenction. Any adaptors that require
database connectivity should inherit from this class.
...
...
@@ -111,16 +104,15 @@ use Bio::EnsEMBL::Utils::Argument qw(rearrange);
sub
new
{
my
$class
=
shift
;
my
(
$db
,
$host
,
$driver
,
$user
,
$password
,
$port
,
$inactive_disconnect
,
$dbconn
,
$dnadb
)
=
my
(
$db
,
$host
,
$driver
,
$user
,
$password
,
$port
,
$inactive_disconnect
,
$dbconn
)
=
rearrange
([
qw(DBNAME HOST DRIVER USER PASS PORT
DISCONNECT_WHEN_INACTIVE DBCONN
DNADB
)
],
@
_
);
DISCONNECT_WHEN_INACTIVE DBCONN )
],
@
_
);
my
$self
=
{};
bless
$self
,
$class
;
if
(
$dbconn
)
{
if
(
$db
||
$host
||
$driver
||
$password
||
$port
||
$inactive_disconnect
||
$dnadb
)
{
if
(
$db
||
$host
||
$driver
||
$password
||
$port
||
$inactive_disconnect
)
{
throw
("
Cannot specify other arguments when -DBCONN argument used.
");
}
...
...
@@ -183,9 +175,9 @@ sub new {
}
if
(
defined
$dnadb
)
{
$self
->
dnadb
(
$dnadb
);
}
#
if(defined $dnadb) {
#
$self->dnadb($dnadb);
#
}
return
$self
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment