~ubuntu-branches/ubuntu/trusty/bioperl/trusty

« back to all changes in this revision

Viewing changes to Bio/DB/SeqFeature/Store/DBI/Pg.pm

  • Committer: Package Import Robot
  • Author(s): Charles Plessy
  • Date: 2013-09-22 13:39:48 UTC
  • mfrom: (3.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20130922133948-c6z62zegjyp7ztou
Tags: 1.6.922-1
* New upstream release.
* Replaces and Breaks grinder (<< 0.5.3-3~) because of overlaping contents.
  Closes: #722910
* Stop Replacing and Breaking bioperl ( << 1.6.9 ): not needed anymore. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
 
96
96
=head1 DESCRIPTION
97
97
 
98
 
Bio::DB::SeqFeature::Store::Pg is the Mysql adaptor for
 
98
Bio::DB::SeqFeature::Store::Pg is the Pg adaptor for
99
99
Bio::DB::SeqFeature::Store. You will not create it directly, but
100
100
instead use Bio::DB::SeqFeature::Store-E<gt>new() to do so.
101
101
 
102
102
See L<Bio::DB::SeqFeature::Store> for complete usage instructions.
103
103
 
104
 
=head2 Using the Mysql adaptor
 
104
=head2 Using the Pg adaptor
105
105
 
106
106
Before you can use the adaptor, you must use the Pgadmin tool to
107
107
create a database and establish a user account with write
115
115
  Argument name       Description
116
116
  -------------       -----------
117
117
 
118
 
 -dsn              The database name. You can abbreviate 
 
118
 -dsn              The database name. You can abbreviate
119
119
                   "dbi:Pg:foo" as "foo" if you wish.
120
120
 
121
121
 -user             Username for authentication.
396
396
  if (!scalar(@schema_exists)) {
397
397
      my $query = "CREATE SCHEMA $namespace";
398
398
          $dbh->do($query) or $self->throw($dbh->errstr);
399
 
          
 
399
 
400
400
          # if temp parameter is set and schema created for this process then enable removal in remove_namespace()
401
401
          if ($self->is_temp) {
402
402
              $self->{delete_schema} = 1;
424
424
  }
425
425
}
426
426
 
 
427
####Overiding the inherited mysql function _prepare
 
428
 
 
429
sub _prepare {
 
430
   my $self = shift;
 
431
   my $query = shift;
 
432
   my $dbh   = $self->dbh;
 
433
   my $schema = $self->{namespace};
 
434
 
 
435
   if ($schema) {
 
436
     $self->_check_for_namespace();
 
437
     $dbh->do("SET search_path TO " . $self->{'schema'} );
 
438
   } else {
 
439
     $dbh->do("SET search_path TO public");
 
440
   }
 
441
   my $sth   = $dbh->prepare_cached($query, {}, 3) or
 
442
   $self->throw($dbh->errstr);
 
443
   $sth;
 
444
}
 
445
 
427
446
sub _finish_bulk_update {
428
447
  my $self = shift;
429
448
  my $dbh  = $self->dbh;
473
492
  my $sthdel = $self->_prepare($querydel);
474
493
  my $sth = $self->_prepare($query);
475
494
 
476
 
  my $parent_id = (ref $parent ? $parent->primary_id : $parent) 
 
495
  my $parent_id = (ref $parent ? $parent->primary_id : $parent)
477
496
    or $self->throw("$parent should have a primary_id");
478
497
 
479
498
  $self->begin_work or $self->throw($dbh->errstr);
537
556
  while (my($frag,$offset) = $sth->fetchrow_array) {
538
557
    substr($frag,0,$start-$offset) = '' if defined $start && $start > $offset;
539
558
    $seq .= $frag;
540
 
  }  
 
559
  }
541
560
  substr($seq,$end-$start+1) = '' if defined $end && $end-$start+1 < length($seq);
542
561
  if ($reversed) {
543
562
    $seq = reverse $seq;
944
963
        my $query = "CREATE TABLE $interval_stats $tables->{interval_stats}";
945
964
        $dbh->do($query) or $self->throw($dbh->errstr);
946
965
    }
947
 
}    
 
966
}
948
967
 
949
968
sub _fetch_indexed_features_sql {
950
969
    my $self     = shift;