From 42586252e514465cd301f2e060c4ffe10e2faa50 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Mon, 27 Aug 2007 21:30:46 +0000 Subject: [PATCH] fix SQL Reports using statements other than select --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Paginator.pm | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 668c4df9d..625d68510 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -2,6 +2,7 @@ - fix: Apostrophy incorrectly escaped as double quote in some places - Remove Help TOC links - Fix hover help for collaboration system rich editor + - Fix using statements other than SELECT in SQL Reports 7.4.4 - fix: Changing group detail adds number to group name diff --git a/lib/WebGUI/Paginator.pm b/lib/WebGUI/Paginator.pm index 4a58fba6a..079ccc2a8 100644 --- a/lib/WebGUI/Paginator.pm +++ b/lib/WebGUI/Paginator.pm @@ -690,10 +690,10 @@ sub setDataByQuery { #Calculate where to start my $start = ( ($pageNumber - 1) * $rowsPerPage ); - #Set the query limits - $sql =~ s/;\s+$//; - $sql .= " limit $start,$rowsPerPage"; - $sql =~ s/\bSELECT\s/SELECT SQL_CALC_FOUND_ROWS /i; + #Set the query limits, but only for select queries + if ($sql =~ s/^\s*SELECT\s/SELECT SQL_CALC_FOUND_ROWS /i) { + $sql =~ s/;?\s*$/ LIMIT $start,$rowsPerPage/; + } #$self->session->errorHandler->warn($sql); #Get only the data necessary from the database