Bio::EnsEMBL::ExternalData
BaseAdaptor
Toolbar
Summary
Bio::EnsEMBL::DBSQL::BaseAdaptor - Base Adaptor for DBSQL adaptors
Package variables
No package variables defined.
Included modules
Inherit
Synopsis
# base adaptor provides
# SQL prepare function
$adaptor->prepare("sql statement");
# get of root db object
$adaptor->db();
# delete memory cycles
$adaptor->deleteObj();
# constructor, ok for inheritence
$adaptor = Bio::EnsEMBL::DBSQL::ClassWhichInheritsFromBaseAdaptor->new($dbobj)
Description
This is a true base class for Adaptors in the Ensembl DBSQL
system. Original idea from Arne
Methods
Methods description
Title : db Usage : $obj->db($newval) Function: Returns : value of db Args : newvalue (optional) |
Title : deleteObj Usage : $obj->deleteObj Function: removes memory cycles. Probably triggered by Root deleteObj Returns : Args : none |
Title : prepare Usage : $sth = $adaptor->prepare("select yadda from blabla") Function: provides a DBI statement handle from the adaptor. A convience function so you dont have to write $adaptor->db->prepare all the time Example : Returns : Args : |
Methods code
sub db
{ my $obj = shift;
if( @_ ) {
my $value = shift;
$obj->{'db'} = $value;
}
return $obj->{'db'}; } |
sub deleteObj
{ my $self = shift;
my @dummy = values %{$self};
foreach my $key ( keys %$self ) {
delete $self->{$key};
}
foreach my $obj ( @dummy ) {
eval {
$obj->deleteObj;
}
} } |
sub new
{ my ($class,$dbobj) = @_;
my $self = {};
bless $self,$class;
if( !defined $dbobj || !ref $dbobj ) {
$self->throw("Don't have a db [$dbobj] for new adaptor");
}
$self->db($dbobj);
return $self; } |
sub prepare
{ my ($self,$string) = @_;
return $self->db->prepare($string); } |
General documentation
Describe contact details here
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _