[Bio] / FigKernelPackages / DBrtns.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/DBrtns.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18, Thu Jun 9 18:34:16 2005 UTC revision 1.23, Tue Nov 22 17:24:17 2005 UTC
# Line 13  Line 13 
13  use Carp;  use Carp;
14    
15  sub new {  sub new {
16      my($class,$dbms,$dbname,$dbuser,$dbpass,$dbport) = @_;      my($class,$dbms,$dbname,$dbuser,$dbpass,$dbport, $dbhost) = @_;
17    
18      $dbms   = defined($dbms)   ? $dbms   : $FIG_Config::dbms;      $dbms   = defined($dbms)   ? $dbms   : $FIG_Config::dbms;
19      $dbname = defined($dbname) ? $dbname : $FIG_Config::db;      $dbname = defined($dbname) ? $dbname : $FIG_Config::db;
20      $dbuser = defined($dbuser) ? $dbuser : $FIG_Config::dbuser;      $dbuser = defined($dbuser) ? $dbuser : $FIG_Config::dbuser;
21      $dbpass = defined($dbpass) ? $dbpass : $FIG_Config::dbpass;      $dbpass = defined($dbpass) ? $dbpass : $FIG_Config::dbpass;
22      $dbport = defined($dbport) ? $dbport : $FIG_Config::dbport;      $dbport = defined($dbport) ? $dbport : $FIG_Config::dbport;
23        $dbhost = defined($dbhost) ? $dbhost : $FIG_Config::dbhost;
24    
25      return DBKernel::new($class, $dbms, $dbname, $dbuser, $dbpass, $dbport);      return DBKernel::new($class, $dbms, $dbname, $dbuser, $dbpass, $dbport, $dbhost);
 }  
   
 sub vacuum_it {  
     my($self,@tables) = @_;  
     my($table);  
   
     my $dbh  = $self->{_dbh};  
     my $dbms = $self->{_dbms};  
     if ($dbms eq "mysql") {  
         return;  
     }  
   
     # this chunk is for Pg  (Postgres)  
     if (@tables == 0) {  
         $self->SQL("VACUUM ANALYZE");  
     } else {  
         foreach $table (@tables) {  
             $self->SQL("VACUUM ANALYZE $table");  
         }  
     }  
26  }  }
27    
28  =head1 get_inserted_id  =head1 get_inserted_id
# Line 51  Line 32 
32  =cut  =cut
33    
34  sub get_inserted_id {  sub get_inserted_id {
35      my($self, $table, $sth) = @_;      my($self, $table, $sth, $id_column) = @_;
36    
37        $id_column = 'id' unless defined($id_column);
38      if ($self->{_dbms} eq "Pg") {      if ($self->{_dbms} eq "Pg") {
39          my $oid = $sth->{pg_oid_status};          my $oid = $sth->{pg_oid_status};
40          my $ret = $self->SQL("select id from $table where oid = ?", undef, $oid);          my $ret = $self->SQL("select $id_column from $table where oid = ?", undef, $oid);
41          return $ret->[0]->[0];          return $ret->[0]->[0];
42      } elsif ($self->{_dbms} eq "mysql") {      } elsif ($self->{_dbms} eq "mysql") {
43          my $id = $self->{_dbh}->{mysql_insertid};          my $id = $self->{_dbh}->{mysql_insertid};
# Line 189  Line 172 
172      push(@opts, "--old-password");      push(@opts, "--old-password");
173      push(@opts, "--max-allowed-packet=128M");      push(@opts, "--max-allowed-packet=128M");
174      #      #
175        # Use InnoDB for large-table support and allegedly better performance.
176        #
177    
178        #push(@opts, "--default-table-type=innodb");
179    
180        #
181      # Oddly, this doesn't seem to work. need to set the environment variable.      # Oddly, this doesn't seem to work. need to set the environment variable.
182      #      #
183      #push(@opts, "--port=$FIG_Config::dbport");      #push(@opts, "--port=$FIG_Config::dbport");
# Line 204  Line 193 
193      #      #
194    
195      my $exe = "$FIG_Config::ext_bin/mysqld_safe";      my $exe = "$FIG_Config::ext_bin/mysqld_safe";
196    
197        print "Start $exe @opts\n";
198      if (! -x $exe)      if (! -x $exe)
199      {      {
200          $exe = "mysqld_safe";          $exe = "mysqld_safe";

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.23

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3