1
# This program is free software; you can redistribute it and/or modify
2
# it under the terms of the GNU General Public License as published by
3
# the Free Software Foundation; version 2 of the License.
5
# This program is distributed in the hope that it will be useful, but
6
# WITHOUT ANY WARRANTY; without even the implied warranty of
7
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8
# General Public License for more details.
10
# You should have received a copy of the GNU General Public License
11
# along with this program; if not, write to the Free Software
12
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
15
package GenTest::Transform::ExecuteAsUnion;
18
@ISA = qw(GenTest GenTest::Transform);
24
use GenTest::Transform;
25
use GenTest::Constants;
28
my ($class, $original_query, $executor) = @_;
30
return STATUS_WONT_HANDLE if $original_query !~ m{\s*SELECT}sio;
32
my $original_query_no_limit = $original_query;
33
$original_query_no_limit =~ s{LIMIT\s+\d+\s+OFFSET\s+\d+\s*$}{}sio;
34
$original_query_no_limit =~ s{LIMIT\s+\d+\s*$}{}sio;
37
"( $original_query ) UNION ALL ( $original_query_no_limit LIMIT 0 ) /* TRANSFORM_OUTCOME_UNORDERED_MATCH */",
38
"( $original_query_no_limit LIMIT 0 ) UNION ALL ( $original_query ) /* TRANSFORM_OUTCOME_UNORDERED_MATCH */",
39
"( $original_query ) UNION DISTINCT ( $original_query ) /* TRANSFORM_OUTCOME_DISTINCT */",
40
"( $original_query ) UNION ALL ( $original_query ) /* TRANSFORM_OUTCOME_SUPERSET */"