Diff for /loncom/lonsql between versions 1.29 and 1.33

version 1.29, 2001/04/02 20:10:09 version 1.33, 2001/04/16 18:36:22
Line 23  sub wanted { Line 23  sub wanted {
     push(@metalist,"$dir/$_");      push(@metalist,"$dir/$_");
 }  }
   
   
 $childmaxattempts=10;  $childmaxattempts=10;
 $run =0;#running counter to generate the query-id  $run =0;#running counter to generate the query-id
   
Line 39  while ($configline=<CONFIG>) { Line 38  while ($configline=<CONFIG>) {
 }  }
 close(CONFIG);  close(CONFIG);
   
   # ------------------------------------- Make sure that database can be accessed
   {
       my $dbh;
       unless (
       $dbh = DBI->connect("DBI:mysql:loncapa","www",$perlvar{'lonSqlAccess'},{ RaiseError =>0,PrintError=>0})
       ) { 
    print "Cannot connect to database!\n";
    exit;
       }
       else {
    $dbh->disconnect;
       }
   }
   
 # --------------------------------------------- Check if other instance running  # --------------------------------------------- Check if other instance running
   
 my $pidfile="$perlvar{'lonDaemons'}/logs/lonsql.pid";  my $pidfile="$perlvar{'lonDaemons'}/logs/lonsql.pid";
Line 60  while ($configline=<CONFIG>) { Line 73  while ($configline=<CONFIG>) {
     chomp($ip);      chomp($ip);
   
     $hostip{$ip}=$id;      $hostip{$ip}=$id;
   
     if ($id eq $perlvar{'lonHostID'}) { $thisserver=$name; }      if ($id eq $perlvar{'lonHostID'}) { $thisserver=$name; }
   
     $PREFORK++;      $PREFORK++;
Line 191  sub make_new_child { Line 203  sub make_new_child {
         #open database handle          #open database handle
  # making dbh global to avoid garbage collector   # making dbh global to avoid garbage collector
  unless (   unless (
  $dbh = DBI->connect("DBI:mysql:loncapa","www","123",{ RaiseError =>0,PrintError=>0})   $dbh = DBI->connect("DBI:mysql:loncapa","www",$perlvar{'lonSqlAccess'},{ RaiseError =>0,PrintError=>0})
  ) {    ) { 
                sleep(10+int(rand(20)));
     &logthis("<font color=blue>WARNING: Couldn't connect to database  ($st secs): $@</font>");      &logthis("<font color=blue>WARNING: Couldn't connect to database  ($st secs): $@</font>");
     print "database handle error\n";      print "database handle error\n";
     exit;      exit;
Line 350  sub reply { Line 363  sub reply {
     }      }
   } else {    } else {
     $answer='self_reply';      $answer='self_reply';
       $answer=subreply($cmd,$server);
   }     } 
   return $answer;    return $answer;
 }  }

Removed from v.1.29  
changed lines
  Added in v.1.33


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>