Skip to content
Snippets Groups Projects
Commit 56c5ce38 authored by Graham McVicker's avatar Graham McVicker
Browse files

not used

parent 6d816894
No related branches found
No related tags found
No related merge requests found
### Bio::EnsEMBL::DBSQL::SQL
package Bio::EnsEMBL::DBSQL::SQL;
use strict;
use DBI;
use Bio::EnsEMBL::DBSQL::SQL::mysql;
use Bio::EnsEMBL::DBSQL::SQL::oracle;
use Bio::EnsEMBL::DBSQL::SQL::sybase;
use Bio::EnsEMBL::DBSQL::SQL::StatementHandle;
use Bio::EnsEMBL::Root;
use vars '@ISA';
@ISA = qw{ DBI::db Bio::EnsEMBL::Root };
sub new {
my( $pkg, $dsn, $user, $password ) = @_;
my $dbh = DBI->connect($dsn, $user, $password, {RaiseError => 0, PrintError => 0});
if ($dbh) {
return bless($dbh, $pkg);
} else {
# Create a BioPerl object in order to throw an exception
my $self = bless {}, $pkg;
$self->throw("Can't connect to SQL database with:\n"
. " dsn = '$dsn'\n"
. " user = '$user'\n"
. " password = '$password'\n"
);
}
}
sub prepare {
my( $dbh, @args ) = @_;
my $sth = $dbh->SUPER::prepare(@args);
if ($sth) {
bless($sth, 'Bio::EnsEMBL::DBSQL::SQL::StatementHandle');
return $sth;
} else {
$dbh->throw("prepare failed: '$DBI::errstr'");
}
}
1;
__END__
=head1 NAME - Bio::EnsEMBL::DBSQL::SQL
=head1 DESCRIPTION
Ensembl's SQL compatability layer.
This module inherits from B<DBI::db>, overriding
the B<prepare> method to bless the created
statement handles into the
B<Bio::EnsEMBL::DBSQL::SQL::StatementHandle>
class.
Database handles created in
B<Bio::Ensembl::DBSQL::Obj> are blessed into one
of the database driver specific classes (eg:
B<Bio::EnsEMBL::DBSQL::SQL::mysql>) which inherit
from this class.
=head1 MEHTODS
=over 4
=item new
my $dbh = Bio::EnsEMBL::DBSQL::SQL::<driver>->new($dsn, $user, $password);
Called by B<Bio::EnsEMBL::DBSQL::Obj::new>, it
creates a B<DBI::db> database handle, blesses it
into the SQL compatability driver package, and
returns it.
=item prepare
=head1 AUTHOR
James Gilbert B<email> jgrg@sanger.ac.uk
### Bio::EnsEMBL::DBSQL::SQL::StatementHandle
package Bio::EnsEMBL::DBSQL::SQL::StatementHandle;
use strict;
use DBI;
use Bio::EnsEMBL::Root;
use vars '@ISA';
@ISA = qw{ DBI::st Bio::EnsEMBL::Root };
sub execute {
my( $sth, @args ) = @_;
my $result = $sth->SUPER::execute(@args);
if ($result) {
return $result;
} else {
$sth->throw("execute failed : '$DBI::errstr'");
}
}
1;
__END__
=head1 NAME - Bio::EnsEMBL::DBSQL::SQL::StatementHandle
=head1 DESCRIPTION
This package inherits from B<DBI::st>, and
overrides its B<execute> function to provide nice
BioPerl style exceptions.
=head1 AUTHOR
James Gilbert B<email> jgrg@sanger.ac.uk
### Bio::EnsEMBL::DBSQL::SQL::mysql
package Bio::EnsEMBL::DBSQL::SQL::mysql;
use strict;
use Bio::EnsEMBL::DBSQL::SQL;
use vars '@ISA';
@ISA = ('Bio::EnsEMBL::DBSQL::SQL');
1;
__END__
=head1 NAME - Bio::EnsEMBL::DBSQL::SQL::mysql
=head1 AUTHOR
James Gilbert B<email> jgrg@sanger.ac.uk
### Bio::EnsEMBL::DBSQL::SQL::oracle
package Bio::EnsEMBL::DBSQL::SQL::oracle;
use strict;
use Bio::EnsEMBL::DBSQL::SQL;
use vars '@ISA';
@ISA = ('Bio::EnsEMBL::DBSQL::SQL');
1;
__END__
=head1 NAME - Bio::EnsEMBL::DBSQL::SQL::oracle
=head1 AUTHOR
James Gilbert B<email> jgrg@sanger.ac.uk
### Bio::EnsEMBL::DBSQL::SQL::sybase
package Bio::EnsEMBL::DBSQL::SQL::sybase;
use strict;
use Bio::EnsEMBL::DBSQL::SQL;
use vars '@ISA';
@ISA = ('Bio::EnsEMBL::DBSQL::SQL');
1;
__END__
=head1 NAME - Bio::EnsEMBL::DBSQL::SQL::sybase
=head1 AUTHOR
James Gilbert B<email> jgrg@sanger.ac.uk
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