--- loncom/interface/lonmysql.pm 2002/08/09 17:08:19 1.5 +++ loncom/interface/lonmysql.pm 2002/08/21 21:29:51 1.7 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # MySQL utility functions # -# $Id: lonmysql.pm,v 1.5 2002/08/09 17:08:19 matthew Exp $ +# $Id: lonmysql.pm,v 1.7 2002/08/21 21:29:51 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -327,7 +327,10 @@ sub connect_to_db { $Apache::lonnet::perlvar{'lonSqlAccess'}, { RaiseError=>0,PrintError=>0}))) { $debugstring = "Unable to connect to loncapa database."; - if ($dbh->err) { + if (! defined($dbh)) { + $debugstring = "Unable to connect to loncapa database."; + $errorstring = "dbh was undefined."; + } elsif ($dbh->err) { $errorstring = "Connection error: ".$dbh->errstr; } return undef; @@ -656,11 +659,6 @@ sub get_rows { } $debugstring = "Got rows matching $condition"; my @Results = @{$sth->fetchall_arrayref}; - foreach my $row (@Results) { - for(my $i=0;$i<@$row;$i++) { - $row->[$i]=&Apache::lonnet::unescape($row->[$i]); - } - } return @Results; } @@ -710,7 +708,7 @@ sub store_row { @Parameters = @$rowdata; } elsif (ref($rowdata) eq 'HASH') { foreach (@{$Tables{$tablename}->{'Col_order'}}) { - push(@Parameters,&Apache::lonnet::escape($rowdata->{$_})); + push(@Parameters,$rowdata->{$_}); } } $sth->execute(@Parameters);