--- loncom/lonsql 2001/03/27 19:57:53 1.26 +++ loncom/lonsql 2001/04/02 20:16:31 1.30 @@ -23,7 +23,18 @@ sub wanted { push(@metalist,"$dir/$_"); } - +{ + my $dbh; + unless ( + $dbh = DBI->connect("DBI:mysql:loncapa","www","123",{ RaiseError =>0,PrintError=>0}) + ) { + print "Cannot connect to database!\n"; + exit; + } + else { + $dbh->disconnect; + } +} $childmaxattempts=10; $run =0;#running counter to generate the query-id @@ -193,10 +204,9 @@ sub make_new_child { unless ( $dbh = DBI->connect("DBI:mysql:loncapa","www","123",{ RaiseError =>0,PrintError=>0}) ) { - my $st=120+int(rand(240)); + sleep(10+int(rand(20))); &logthis("WARNING: Couldn't connect to database ($st secs): $@"); print "database handle error\n"; - sleep($st); exit; }; @@ -251,7 +261,7 @@ sub make_new_child { } } # do custom metadata searching here and build into result - if ($custom) { + if ($custom or $customshow) { &logthis("am going to do custom query for $custom"); if ($query) { @metalist=map {$perlvar{'lonDocRoot'}.$_.'.meta'} @files; @@ -284,7 +294,7 @@ sub make_new_child { $m2=~s/\.meta$//; unless ($query) { my $q2="select * from metadata where url like '$m2'"; - my $sth = $dbh->prepare($query); + my $sth = $dbh->prepare($q2); $sth->execute(); my $r1=$sth->fetchall_arrayref; map {my $a=$_;