fix: SQLReport now throws fatal if can't find DatabaseLink

DatabaseLink now warns if can't find DatabaseLink
This commit is contained in:
Doug Bell 2006-10-27 20:42:59 +00:00
parent 4ed1ffe3c7
commit 50e7645322
3 changed files with 16 additions and 6 deletions

View file

@ -5,6 +5,10 @@
- Fixed a bug where logging in/out would cause a blank page display.
- change: made all LWP user agents use env_proxy
7.1.3
- fix: SQLReport now returns error if can't find DatabaseLink
- WebGUI::DatabaseLink->new now warns if can't find requested DatabaseLink
7.1.2
- Fixed a bug that caused workflows to fail if collaboration systems and
posts for that CS were in the same version tag at commit time.

View file

@ -566,7 +566,8 @@ sub _processQuery {
my $i18n = WebGUI::International->new($self->session,"Asset_SQLReport");
push(@{$self->{_debug_loop}},{'debug.output'=>$i18n->get(17).$query});
push(@{$self->{_debug_loop}},{'debug.output'=>$i18n->get('debug placeholder parameters').join(",",@$placeholderParams)});
my $dbLink = WebGUI::DatabaseLink->new($self->session,$self->{_query}{$nr}{databaseLinkId});
my $dbLink = WebGUI::DatabaseLink->new($self->session,$self->{_query}{$nr}{databaseLinkId})
|| return $self->session->errorHandler->error("Could not find database link '".$self->{_query}{$nr}{databaseLinkId}."'. Has it been created?");
my $dbh = $dbLink->db;
if (defined $dbh) {

View file

@ -219,9 +219,9 @@ is reserved for the WebGUI database.
=cut
sub new {
my ($class, $databaseLinkId, %databaseLink);
tie %databaseLink, 'Tie::CPHash';
$class = shift;
my ($class, $databaseLinkId, %databaseLink);
tie %databaseLink, 'Tie::CPHash';
$class = shift;
my $session = shift;
$databaseLinkId = shift;
unless ($databaseLinkId eq "") {
@ -238,8 +238,13 @@ sub new {
%databaseLink = $session->db->quickHash("select * from databaseLink where databaseLinkId=".$session->db->quote($databaseLinkId));
}
}
return undef unless defined($databaseLink{databaseLinkId});
unless (defined($databaseLink{databaseLinkId}))
{
$session->errorHandler->warn("Could not find database link '".$databaseLinkId."'");
return undef;
}
bless {_session=>$session, _databaseLink => \%databaseLink }, $class;
}