These documents are For the HEAD of the CVS repository on July 19, 2007 Api docs for previous releases

Modware

DBH

Summary Package variables Synopsis Description General documentation Methods

Summary
   Modware::DBH - Global database connection object.  Use for commits, rollbacks, custom SQL.
Package variables top
No package variables defined.
Included modulestop
Chado::AutoDBI
Data::Dumper
Synopsistop
   # USE CASE: PERFORM A DATABASE TRANSACTION WITH ROLLBACK ON ERROR
my $dbh = new Modware::DBH;
eval {
my $feature = new Modware::Feature( -primary_id => 'DDB0191090' );
$feature->description('abc');

# some more error prone code

};
if ($@){
warn $@;

# ROLLBACK WILL BE ISSUED ON ALL DATABASE CHANGES INVOLVING Modware OR
# A DATABASE HANDLE CREATED WITH my $dbh = new Modware::DBH
$dbh->rollback();
}
Descriptiontop
   This is a singleton class: every call to 'new Modware::DBH' will return the same
database handle: that used by Chado::AutoDBI

Use this class to issue direct sql against the database and also for commits and rollbacks.

You normally will not have to commit though since destructor for this class issues a commit
on unloading.
Methodstop
Chado::Feature::next_unique_nameNo descriptionCode
get_public_idDescriptionCode
newNo descriptionCode

Methods description

get_public_idcodetopprevnext
 Title    : _insert_primary_id
Usage : $feature->_insert_primary_id;
Function : inserts and links primary_id to feature
Returns : Chado::Dbxref object
Args : none

Methods code

Chado::Feature::next_unique_namedescriptiontopprevnext
sub Chado::Feature::next_unique_name {
   my ($class, @args) = @_;
   my $dbh = new Modware::DBH;
   $sth = $dbh->prepare("select nextval('feature_uniquename_seq')");
   $sth->execute();
   my $return = $sth->fetchrow();
   $sth->finish();
   return $return;
}
get_public_iddescriptiontopprevnext
sub get_public_id {
   my ( $self, $prefix ) = @_;

   # prefix should be passed in, but a default is the $ENV{'IDENTIFIER_PREFIX'}
# from config.xml
$prefix ||= $ENV{'IDENTIFIER_PREFIX'}; my $number = Chado::Feature->next_unique_name(); $number = sprintf("%08d", $number); my $new_id = $ENV{'IDENTIFIER_PREFIX'}; $new_id.= $number; # created the dbxref
my $dbxref = Chado::Dbxref->find_or_create( db_id => Modware::Constant->Application_db_id(), accession => $new_id ); return $dbxref;
}
newdescriptiontopprevnext
sub new {
   Chado::DBI->db_Main();
}

General documentation

AUTHOR - Eric Just top
   Eric Just e-just@northwestern.edu
APPENDIX top
   The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _