--- loncom/lonsql 2003/07/25 17:07:06 1.56 +++ loncom/lonsql 2004/05/03 16:20:57 1.58 @@ -3,7 +3,7 @@ # The LearningOnline Network # lonsql - LON TCP-MySQL-Server Daemon for handling database requests. # -# $Id: lonsql,v 1.56 2003/07/25 17:07:06 bowersj2 Exp $ +# $Id: lonsql,v 1.58 2004/05/03 16:20:57 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -41,42 +41,6 @@ Note that a lonsql.pid file contains the =head1 OVERVIEW -The SQL database in LON-CAPA is used for catalog searches against -resource metadata only. The authoritative version of the resource -metadata is an XML-file on the normal file system (same file name as -resource plus ".meta"). The SQL-database is a cache of these files, -and can be reconstructed from the XML files at any time. - -The current database is implemented assuming a non-adjustable -architecture involving these data fields (specific to each version of -a resource). - -=over 4 - -=item * title - -=item * author - -=item * subject - -=item * notes - -=item * abstract - -=item * mime - -=item * language - -=item * creationdate - -=item * lastrevisiondate - -=item * owner - -=item * copyright - -=back - =head2 Purpose within LON-CAPA LON-CAPA is meant to distribute A LOT of educational content to A LOT @@ -139,6 +103,7 @@ use strict; use lib '/home/httpd/lib/perl/'; use LONCAPA::Configuration; +use LONCAPA::lonmetadata(); use IO::Socket; use Symbol; @@ -251,6 +216,11 @@ unless ($dbh = DBI->connect("DBI:mysql:l my $subj="LON: $perlvar{'lonHostID'} Cannot connect to database!"; system("echo 'Cannot connect to MySQL database!' |". " mailto $emailto -s '$subj' > /dev/null"); + + open(SMP,'>/home/httpd/html/lon-status/mysql.txt'); + print SMP 'time='.time.'&mysql=defunct'."\n"; + close(SMP); + exit 1; } else { $dbh->disconnect; @@ -506,8 +476,9 @@ sub do_sql_query { #prepare and execute the query my $sth = $dbh->prepare($query); unless ($sth->execute()) { - &logthis("WARNING: ". - "Could not retrieve from database: $@"); + &logthis(''. + 'WARNING: Could not retrieve from database:'. + $sth->errstr().''); } else { my $aref=$sth->fetchall_arrayref; foreach my $row (@$aref) { @@ -966,17 +937,6 @@ sub DISCONNECT { } - - - - - - - - - -# ----------------------------------- POD (plain old documentation, CPAN style) - =pod =back