[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.15, Wed May 11 18:43:19 2005 UTC revision 1.17, Wed Jun 1 01:18:50 2005 UTC
# Line 15  Line 15 
15      $dbname = defined($dbname) ? $dbname : $FIG_Config::db;      $dbname = defined($dbname) ? $dbname : $FIG_Config::db;
16      $dbuser = defined($dbuser) ? $dbuser : $FIG_Config::dbuser;      $dbuser = defined($dbuser) ? $dbuser : $FIG_Config::dbuser;
17      $dbpass = defined($dbpass) ? $dbpass : $FIG_Config::dbpass;      $dbpass = defined($dbpass) ? $dbpass : $FIG_Config::dbpass;
     $dbpass = defined($dbpass) ? $dbpass : $FIG_Config::dbpass;  
18      $dbport = defined($dbport) ? $dbport : $FIG_Config::dbport;      $dbport = defined($dbport) ? $dbport : $FIG_Config::dbport;
19    
20      my @opts;      my @opts;
# Line 122  Line 121 
121  {  {
122      my($self, $table) = @_;      my($self, $table) = @_;
123    
124      return (grep { $table eq $_ } $self->get_tables()) > 0;      return (grep { lc $table eq lc $_ } $self->get_tables()) > 0;
125  }  }
126    
127  sub drop_table {  sub drop_table {
# Line 165  Line 164 
164      my $flds = $arg{flds};      my $flds = $arg{flds};
165      my $dbh  = $self->{_dbh};      my $dbh  = $self->{_dbh};
166      my $dbms = $self->{_dbms};      my $dbms = $self->{_dbms};
   
167      my $type;      my $type;
168    
169      if ($arg{type})      if ($arg{type})
170      {      {
171          $type = " engine = $arg{type} ";          $type = " engine = $arg{type} ";
172      }      }
173    
174        eval {
175      $dbh->do("CREATE TABLE $tbl ( $flds ) $type;");      $dbh->do("CREATE TABLE $tbl ( $flds ) $type;");
176        };
177        if ($@)
178        {
179            confess "create table $tbl failed: $@";
180        }
181  }  }
182    
183  sub load_table {  sub load_table {
# Line 278  Line 283 
283      }      }
284  }  }
285    
   
286  #  #
287  # Following are database administration routines. They create an instance of a ServerAdmin class  # Following are database administration routines. They create an instance of a ServerAdmin class
288  # for the appropriate server type (in order to eliminate the if mysql / if pg / etc stuff).  # for the appropriate server type (in order to eliminate the if mysql / if pg / etc stuff).
# Line 388  Line 392 
392    
393  sub start_server  sub start_server
394  {  {
395      my($self) = @_;      my($self, $dont_fork) = @_;
396    
397      print "Starting mysql server\n";      print "Starting mysql server\n";
398    
# Line 425  Line 429 
429          $exe = "mysqld_safe";          $exe = "mysqld_safe";
430      }      }
431    
432      print "Would run $exe @opts\n";      if ($dont_fork)
433        {
434            $ENV{MYSQL_TCP_PORT} = $FIG_Config::dbport;
435            exec $exe, @opts;
436        }
437        else
438        {
439      my $pid = fork;      my $pid = fork;
440    
441      if ($pid == 0)      if ($pid == 0)
# Line 436  Line 445 
445          $ENV{MYSQL_TCP_PORT} = $FIG_Config::dbport;          $ENV{MYSQL_TCP_PORT} = $FIG_Config::dbport;
446          exec $exe, @opts;          exec $exe, @opts;
447      }      }
   
448      print "Forked db server $pid\n";      print "Forked db server $pid\n";
449  }  }
450    
451    }
452    
453    
454  1  1

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.17

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3