From c16224f6a28813e8956161ccbf506ade2d2dd68c Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Mon, 31 Mar 2008 08:22:37 +0000 Subject: [PATCH] added: Better error messages when SQL Report lacks a query --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Wobject/SQLReport.pm | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 4a64054c8..67028b2b1 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -11,6 +11,7 @@ - fixed: Unable to communicate with Spectre under alternate locales - fixed: Project Manager can't track non-integer durations - fixed: Unable to edit CS posts that were denied as a normal user + - added: Better error messages when SQL Report lacks a query (William McKee, Knowmad Technologies) 7.5.8 - moved Gallery utility methods to WebGUI::Utility::Gallery diff --git a/lib/WebGUI/Asset/Wobject/SQLReport.pm b/lib/WebGUI/Asset/Wobject/SQLReport.pm index 466f4c9bc..c2dc9c8fe 100644 --- a/lib/WebGUI/Asset/Wobject/SQLReport.pm +++ b/lib/WebGUI/Asset/Wobject/SQLReport.pm @@ -577,6 +577,12 @@ sub _processQuery { $prefix = 'query'.$nr.'.'; } + if (! $self->{_query}{$nr}{dbQuery}) { + $self->session->errorHandler->warn("No query specified for query $nr on '" . $self->getId . "'"); + push @{$self->{_debug_loop}}, { 'debug.output' => "No query specfied for query $nr" }; + return \%var; + } + # Parse placeholder parameters my $placeholderParams = $self->_parsePlaceholderParams($self->{_query}{$nr}{placeholderParams}); @@ -593,7 +599,7 @@ sub _processQuery { push(@{$self->{_debug_loop}},{'debug.output'=>$i18n->get('debug placeholder parameters').join(",",@$placeholderParams)}); my $dbLink = WebGUI::DatabaseLink->new($self->session,$self->{_query}{$nr}{databaseLinkId}); if (!$dbLink) { - $self->session->errorHandler->error("Could not find database link '".$self->{_query}{$nr}{databaseLinkId}."'. Has it been created?"); + $self->session->errorHandler->error("Could not find database link for query #$nr: '".$self->{_query}{$nr}{databaseLinkId}."'. Has it been created?"); push @{$self->{_debug_loop}}, { 'debug.output' => 'Could not find database link'}; return \%var; }