Skip to content

Commit

Permalink
merge files.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmueller committed May 7, 2012
1 parent 283f717 commit ff37f29
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/CXGN/DB/Object.pm
Expand Up @@ -60,6 +60,7 @@ sub new {
my $param = shift;

my $self = $class->SUPER::new();

if ( ref($param) ) {
if ( $param->can('prepare') && $param->can('selectall_arrayref') )
{ # it's a DBI handle of some sort
Expand All @@ -78,7 +79,6 @@ sub new {
}
else {
carp "A parameter is required in CXGN::DB::Object constructor";

}
return $self;
}
Expand Down
20 changes: 13 additions & 7 deletions lib/CXGN/Map.pm
Expand Up @@ -32,10 +32,16 @@ This class defines the following functions to be implemented by the subclasses,
=cut

use Modern::Perl;

use strict;

package CXGN::Map;

use CXGN::DB::Connection;
use CXGN::Map::Version;

use base "CXGN::DB::Object";

=head2 new
Usage: my $map = CXGN::Map->new($dbh, {map_version_id=>30})
Expand All @@ -53,9 +59,9 @@ use CXGN::Map::Version;
sub new {
my $class=shift;
my($dbh,$map_info)=@_;
my $self=bless({},$class);
my $self=$class->SUPER::new($dbh);
unless(CXGN::DB::Connection::is_valid_dbh($dbh)){die"Invalid DBH";}
ref($map_info) eq 'HASH' or die"Must send in a dbh and hash ref with a map_id key or a map_version_id key";
ref($map_info) eq 'HASH' or die"Must send in a dbh and hash ref with a map_id key or a map_version_id key";
$self->{map_version_id}=$map_info->{map_version_id};
$self->{map_id}=$map_info->{map_id};

Expand All @@ -75,7 +81,7 @@ sub new {
$map_version_id_q->execute($self->{map_id});
($self->{map_version_id})=$map_version_id_q->fetchrow_array();
}
$self->{map_version_id} or return undef;
$self->{map_version_id} or return undef;
my $general_info_q=$dbh->prepare
('
select
Expand Down Expand Up @@ -130,11 +136,11 @@ sub new {

sub store {
my $self = shift;
my $dbh = CXGN::DB::Connection->new();

my $map_id = $self->get_map_id();
print STDERR "map id from store: $map_id\n";
if ($map_id) {
my $sth = $dbh->prepare("UPDATE sgn.map SET
my $sth = $self->get_dbh()->prepare("UPDATE sgn.map SET
short_name = ?,
long_name = ?,
abstract = ?,
Expand Down Expand Up @@ -191,7 +197,7 @@ sub new_map {
}

unless ($map_id) {
$sth = $dbh->prepare("INSERT INTO sgn.map (short_name) VALUES (?)");
$sth = $dbh->prepare("INSERT INTO sgn.map (short_name, map_type) VALUES (?, 'genetic')");
$sth->execute($name);
$map_id = $dbh->last_insert_id("map", "sgn");
print STDERR "stored new Map Id: $map_id\n";
Expand Down
10 changes: 5 additions & 5 deletions lib/CXGN/People/BACStatusLog.pm
@@ -1,16 +1,16 @@
package CXGN::People::BACStatusLog;


use strict;
use warnings;

package CXGN::People::BACStatusLog;

use base qw | CXGN::DB::Object |;

use Carp 'croak';
use English;
use POSIX;
use List::Util qw/sum min/;
#use base qw/CXGN::Class::DBI/;

use base qw | CXGN::DB::Object |;

use CXGN::Genomic::CloneIdentifiers qw/parse_clone_ident assemble_clone_ident/;

=head2 new
Expand Down

0 comments on commit ff37f29

Please sign in to comment.