[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.12, Fri Apr 8 08:32:10 2005 UTC revision 1.15, Wed May 11 18:43:19 2005 UTC
# Line 71  Line 71 
71    
72      if ($sql =~ /^\s*select/i)      if ($sql =~ /^\s*select/i)
73      {      {
74          my $ok = eval {          eval {
75              $tmp = $dbh->selectall_arrayref($sql, undef, @bind_values);              $tmp = $dbh->selectall_arrayref($sql, undef, @bind_values);
76          };          };
77          if (!$ok)          if (!$tmp or $@)
78          {          {
79              confess "Try running 'load_links' and 'load_attributes' to fix this error:\n$@";              confess "Try running 'load_links' and 'load_attributes' to fix this error:\n$@";
80              #print STDERR "DBrtns.pm error: SQL $sql failed\n";              #print STDERR "DBrtns.pm error: SQL $sql failed\n";
# Line 165  Line 165 
165      my $flds = $arg{flds};      my $flds = $arg{flds};
166      my $dbh  = $self->{_dbh};      my $dbh  = $self->{_dbh};
167      my $dbms = $self->{_dbms};      my $dbms = $self->{_dbms};
168      $dbh->do("CREATE TABLE $tbl ( $flds );");  
169        my $type;
170    
171        if ($arg{type})
172        {
173            $type = " engine = $arg{type} ";
174        }
175        $dbh->do("CREATE TABLE $tbl ( $flds ) $type;");
176  }  }
177    
178  sub load_table {  sub load_table {
# Line 177  Line 184 
184      my $delim    = $arg{delim};      my $delim    = $arg{delim};
185      my $dbh  = $self->{_dbh};      my $dbh  = $self->{_dbh};
186      my $dbms = $self->{_dbms};      my $dbms = $self->{_dbms};
187        my $result;
188    
189      if ($file)      if ($file)
190      {      {
191          if ($dbms eq "mysql")          if ($dbms eq "mysql")
192          {          {
193              $dbh->do("LOAD DATA LOCAL INFILE '$file' REPLACE INTO TABLE $tbl;");              $result = $dbh->do("LOAD DATA LOCAL INFILE '$file' REPLACE INTO TABLE $tbl;");
194          }          }
195          elsif ($dbms eq "Pg")          elsif ($dbms eq "Pg")
196          {          {
197              $dbh->do("COPY $tbl FROM '$file' USING DELIMITERS '$delim';");              $result = $dbh->do("COPY $tbl FROM '$file' USING DELIMITERS '$delim';");
198          }          }
199      }      }
200        return $result;
201  }  }
202    
203  sub create_index {  sub create_index {
# Line 329  Line 338 
338    
339      my $rc = system($exe,      my $rc = system($exe,
340                      "--datadir=$db_dir",                      "--datadir=$db_dir",
341                        "--basedir=$FIG_Config::common_runtime",
342                      "--user=$FIG_Config::dbuser");                      "--user=$FIG_Config::dbuser");
343      if ($rc != 0)      if ($rc != 0)
344      {      {
# Line 399  Line 409 
409      #      #
410      #push(@opts, "--port=$FIG_Config::dbport");      #push(@opts, "--port=$FIG_Config::dbport");
411    
412        if (@FIG_Config::db_server_startup_options)
413        {
414            push(@opts, @FIG_Config::db_server_startup_options)
415        }
416    
417      #      #
418      # We are going to assume that if mysql has shipped with this release, we'll use it. Otherwise      # We are going to assume that if mysql has shipped with this release, we'll use it. Otherwise
419      # try to use a system one.      # try to use a system one.
# Line 410  Line 425 
425          $exe = "mysqld_safe";          $exe = "mysqld_safe";
426      }      }
427    
428        print "Would run $exe @opts\n";
429    
430      my $pid = fork;      my $pid = fork;
431    
432      if ($pid == 0)      if ($pid == 0)

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3