Commit c8fcd6c2 authored by Ian Longden's avatar Ian Longden
Browse files

DBAdaptor method db renamed dbc to stop confusion so all references to this have been changed

parent 8aaaba21
......@@ -529,7 +529,7 @@ sub remove_from_MiscFeature {
throw("MiscFeature is not stored in this database.");
}
my $sth = $db->db->prepare("DELETE FROM misc_attrib " .
my $sth = $db->dbc->prepare("DELETE FROM misc_attrib " .
"WHERE misc_feature_id = ?");
$sth->execute($mf->dbID());
......
......@@ -126,7 +126,7 @@ sub new {
if( ref($dbobj) =~ /DBAdaptor$/){
$self->db($dbobj);
$self->dbc($dbobj->db);
$self->dbc($dbobj->dbc);
}
else{
throw("Don't have a DBAdaptor [$dbobj] for new adaptor");
......
......@@ -170,7 +170,7 @@ sub generic_fetch {
#append additional clauses which may have been defined
$sql .= "\n$final_clause";
my $sth = $db->db->prepare($sql);
my $sth = $db->dbc->prepare($sql);
$sth->execute;
my $res = $self->_objs_from_sth($sth, $mapper, $slice);
......
......@@ -802,7 +802,7 @@ sub store {
# store the coordinate system in the database
#
my $sth = $db->db->prepare('INSERT INTO coord_system ' .
my $sth = $db->dbc->prepare('INSERT INTO coord_system ' .
'SET name = ?, ' .
'version = ?, ' .
'attrib = ?,' .
......
......@@ -203,7 +203,7 @@ sub new_fast{
$con->isa('Bio::EnsEMBL::DBSQL::DBConnection')) {
throw("$con passed is not of type Bio::EnsEMBL::DBSQL::DBConnection");
}
$self->db($con);
$self->dbc($con);
$self->species($con->species());
$self->group($con->group());
......@@ -225,11 +225,11 @@ sub new_merged{
=head2 db
=head2 dbc
Arg[1] : (optional) Bio::EnsEMBL::DBSQL::DBConnection
Exmaple : $dbc = $dba->db();
Exmaple : $dbc = $dba->dbc();
Description: Getter/Setter for DBConnection.
Returntype : Bio::EnsEMBL::DBSQL::DBConnection
Exceptions : none
......@@ -237,11 +237,22 @@ sub new_merged{
=cut
sub db{
sub dbc{
my ($self, $arg ) = @_;
( defined $arg ) &&
( $self->{_db} = $arg );
$self->{_db};
( $self->{_dbc} = $arg );
$self->{_dbc};
}
=head2 db
=cut
sub db{
my ($self, $arg ) = @_;
deprecate("db Should no longer be called from the DBAdaptor. DBConnection should now be used OR preferably the object adaptor itself\n");
return $self->dbc($arg);
}
......
......@@ -191,7 +191,7 @@ sub store {
my $seq_region_id;
($pexon, $seq_region_id) = $self->_pre_store($pexon);
my $sth = $db->db->prepare
my $sth = $db->dbc->prepare
("INSERT into prediction_exon (prediction_transcript_id, exon_rank, " .
"seq_region_id, seq_region_start, seq_region_end, " .
"seq_region_strand, start_phase, score, p_value) " .
......
......@@ -1224,7 +1224,7 @@ sub store {
#store the seq_region
my $sth = $db->db->prepare("INSERT INTO seq_region " .
my $sth = $db->dbc->prepare("INSERT INTO seq_region " .
"SET name = ?, " .
" length = ?, " .
" coord_system_id = ?" );
......@@ -1267,7 +1267,7 @@ sub prepare {
my $self = shift;
my $sql = shift;
return $self->db()->dnadb()->db->prepare( $sql );
return $self->db()->dnadb()->dbc->prepare( $sql );
}
sub _build_exception_cache {
......
......@@ -130,7 +130,7 @@ sub is_stored {
my $db = shift;
if($db and $db->isa('Bio::EnsEMBL::DBSQL::DBAdaptor')) {
$db = $db->db();
$db = $db->dbc();
}
if(!$db || !ref($db) || !$db->isa('Bio::EnsEMBL::DBSQL::DBConnection')) {
throw('db argument must be a Bio::EnsEMBL::DBSQL::DBConnection');
......
......@@ -17,7 +17,7 @@ my $dba = $ens_test->get_DBAdaptor("core");
ok($dba);
my $sth = $dba->db->prepare("select * from gene");
my $sth = $dba->dbc->prepare("select * from gene");
$sth->execute;
ok(scalar($sth->rows) == 20);
......@@ -42,10 +42,10 @@ ok(scalar($sth->rows) == 20);
# delete 9 genes from the db
$sth = $dba->db->prepare("delete from gene where gene_id >= 18266");
$sth = $dba->dbc->prepare("delete from gene where gene_id >= 18266");
$sth->execute;
$sth = $dba->db->prepare("select * from gene");
$sth = $dba->dbc->prepare("select * from gene");
$sth->execute;
ok(scalar($sth->rows) == 10);
......
......@@ -50,7 +50,7 @@ $aa->store_on_MiscFeature($mf, [$attrib]);
#
# make sure the misc_attrib table was updated
#
my $count = $db->db->db_handle->selectall_arrayref
my $count = $db->dbc->db_handle->selectall_arrayref
("SELECT count(*) FROM misc_attrib " .
"WHERE misc_feature_id = 1")->[0]->[0];
......@@ -59,7 +59,7 @@ ok($count == 1);
#
# make sure the attrib_type table was updated
#
$count = $db->db->db_handle->selectall_arrayref
$count = $db->dbc->db_handle->selectall_arrayref
("SELECT count(*) FROM attrib_type " .
"WHERE code = 'test_code'")->[0]->[0];
ok($count == 1);
......@@ -87,7 +87,7 @@ $aa->remove_from_MiscFeature($mf);
#
# make sure the misc_attrib table was updated
#
$count = $db->db->db_handle->selectall_arrayref
$count = $db->dbc->db_handle->selectall_arrayref
("SELECT count(*) FROM misc_attrib " .
"WHERE misc_feature_id = 1")->[0]->[0];
......@@ -119,7 +119,7 @@ $aa->store_on_Slice($slice, [$attrib]);
#
# make sure the seq_region_attrib table was updated
#
$count = $db->db->db_handle->selectall_arrayref
$count = $db->dbc->db_handle->selectall_arrayref
("SELECT count(*) FROM seq_region_attrib " .
"WHERE seq_region_id = ".$slice->get_seq_region_id())->[0]->[0];
......@@ -128,7 +128,7 @@ ok($count == 1);
#
# make sure the attrib_type table was updated
#
$count = $db->db->db_handle->selectall_arrayref
$count = $db->dbc->db_handle->selectall_arrayref
("SELECT count(*) FROM attrib_type " .
"WHERE code = 'test_code2'")->[0]->[0];
ok($count == 1);
......@@ -156,7 +156,7 @@ $aa->remove_from_Slice($slice);
#
# make sure the seq_region_attrib table was updated
#
$count = $db->db->db_handle->selectall_arrayref
$count = $db->dbc->db_handle->selectall_arrayref
("SELECT count(*) FROM seq_region_attrib " .
"WHERE seq_region_id = " . $slice->get_seq_region_id())->[0]->[0];
......@@ -178,7 +178,7 @@ $aa->store_on_Slice($slice, [$attrib]);
#
# make sure the seq_region_attrib table was updated
#
$count = $db->db->db_handle->selectall_arrayref
$count = $db->dbc->db_handle->selectall_arrayref
("SELECT count(*) FROM seq_region_attrib " .
"WHERE seq_region_id = ".$slice->get_seq_region_id())->[0]->[0];
......@@ -187,7 +187,7 @@ ok($count == 1);
#
# make sure the attrib_type table was updated
#
$count = $db->db->db_handle->selectall_arrayref
$count = $db->dbc->db_handle->selectall_arrayref
("SELECT count(*) FROM attrib_type " .
"WHERE code = 'test_code2'")->[0]->[0];
ok($count == 1);
......
......@@ -36,7 +36,7 @@ $multi_db->save('core', 'dnac', 'seq_region');
#we can get weird padding at the end due to the last byte being not
#fully packed but still labelled as non-gap
my $sth =
$db->db->prepare('INSERT INTO seq_region (name, length, coord_system_id) ' .
$db->dbc->prepare('INSERT INTO seq_region (name, length, coord_system_id) ' .
'VALUES (?,?,?)');
$sth->execute('testfrag', $len,$contig_cs->dbID);
......
......@@ -155,7 +155,7 @@ ok(!$cs->is_sequence_level);
ok(!$cs->is_top_level);
ok($cs->rank() == 10);
my $sth = $db->db->prepare('SELECT attrib FROM coord_system ' .
my $sth = $db->dbc->prepare('SELECT attrib FROM coord_system ' .
'WHERE name = ? and version = ?');
$sth->execute('newsystem', 'NCBI35');
......
......@@ -30,12 +30,12 @@ my $db = $multi->get_DBAdaptor('core');
#
my $dbc;
{
my $db_name = $db->db->dbname;
my $port = $db->db->port;
my $user = $db->db->username;
my $pass = $db->db->password;
my $host = $db->db->host;
my $driver = $db->db->driver;
my $db_name = $db->dbc->dbname;
my $port = $db->dbc->port;
my $user = $db->dbc->username;
my $pass = $db->dbc->password;
my $host = $db->dbc->host;
my $driver = $db->dbc->driver;
$dbc = Bio::EnsEMBL::DBSQL::DBConnection->new(-dbname => $db_name,
-user => $user,
......
......@@ -37,7 +37,7 @@ ok( $db );
my $dbEntryAdaptor = $db->get_DBEntryAdaptor();
my $sth = $db->db->prepare( 'select count(*) from object_xref where ensembl_object_type = "Translation"' );
my $sth = $db->dbc->prepare( 'select count(*) from object_xref where ensembl_object_type = "Translation"' );
$sth->execute();
my ( $xref_count ) = $sth->fetchrow_array();
......
......@@ -603,7 +603,7 @@ debug( "Storing gene" );
$gene_ad->store($gene);
my $dbe_id = $db->db->db_handle->selectall_arrayref("SELECT display_xref_id FROM gene")->[0]->[0];
my $dbe_id = $db->dbc->db_handle->selectall_arrayref("SELECT display_xref_id FROM gene")->[0]->[0];
ok($dbe_id && $dbe_id == $dbe->dbID());
......
......@@ -109,7 +109,7 @@ ok($marker_feature->dbID &&
$marker_feature->adaptor == $mfa);
my $sth = $db->db->prepare('SELECT count(*) from marker_feature');
my $sth = $db->dbc->prepare('SELECT count(*) from marker_feature');
$sth->execute;
my ($count) = $sth->fetchrow_array;
$sth->finish();
......
......@@ -73,7 +73,7 @@ $msa->store($misc_set);
ok($misc_set->dbID());
ok($misc_set->adaptor() == $msa);
my $count = $db->db->db_handle->selectall_arrayref
my $count = $db->dbc->db_handle->selectall_arrayref
("SELECT COUNT(*) FROM misc_set WHERE code = 'code'")->[0]->[0];
ok($count == 1);
......@@ -99,7 +99,7 @@ $msa->store($misc_set);
ok($misc_set->dbID && $misc_set->adaptor);
$count = $db->db->db_handle->selectall_arrayref
$count = $db->dbc->db_handle->selectall_arrayref
("SELECT COUNT(*) FROM misc_set WHERE code = 'code'")->[0]->[0];
ok($count == 1);
......
......@@ -406,7 +406,7 @@ ok($slice->seq_region_name =~ /$clone_name\.\d+/);
# highest (lowest-numbered) ranked comes out first
$multi->hide('core', 'seq_region');
my $sth = $db->db->prepare(qq{INSERT INTO seq_region (coord_system_id, name,
my $sth = $db->dbc->prepare(qq{INSERT INTO seq_region (coord_system_id, name,
length)
SELECT cs.coord_system_id, 'TESTREGION', 1000000
FROM coord_system cs
......
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