version 1.5, 2002/08/09 17:08:19
|
version 1.7, 2002/08/21 21:29:51
|
Line 327 sub connect_to_db {
|
Line 327 sub connect_to_db {
|
$Apache::lonnet::perlvar{'lonSqlAccess'}, |
$Apache::lonnet::perlvar{'lonSqlAccess'}, |
{ RaiseError=>0,PrintError=>0}))) { |
{ RaiseError=>0,PrintError=>0}))) { |
$debugstring = "Unable to connect to loncapa database."; |
$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; |
$errorstring = "Connection error: ".$dbh->errstr; |
} |
} |
return undef; |
return undef; |
Line 656 sub get_rows {
|
Line 659 sub get_rows {
|
} |
} |
$debugstring = "Got rows matching $condition"; |
$debugstring = "Got rows matching $condition"; |
my @Results = @{$sth->fetchall_arrayref}; |
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; |
return @Results; |
} |
} |
|
|
Line 710 sub store_row {
|
Line 708 sub store_row {
|
@Parameters = @$rowdata; |
@Parameters = @$rowdata; |
} elsif (ref($rowdata) eq 'HASH') { |
} elsif (ref($rowdata) eq 'HASH') { |
foreach (@{$Tables{$tablename}->{'Col_order'}}) { |
foreach (@{$Tables{$tablename}->{'Col_order'}}) { |
push(@Parameters,&Apache::lonnet::escape($rowdata->{$_})); |
push(@Parameters,$rowdata->{$_}); |
} |
} |
} |
} |
$sth->execute(@Parameters); |
$sth->execute(@Parameters); |