~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to tests/test_tools/randgen/lib/GenTest/Transform/ExecuteAsUnion.pm

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs
  • Date: 2013-10-29 15:43:40 UTC
  • mfrom: (1.2.12) (2.1.19 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20131029154340-2gp39el6cv8bwf2o
Tags: 1:7.2.3-2ubuntu1
* Merge from debian, remaining changes:
  - Link against boost_system because of boost_thread.
  - Add required libs to message/include.am
  - Add upstart job and adjust init script to be upstart compatible.
  - Disable -floop-parallelize-all due to gcc-4.8/4.9 compiler ICE
    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57732

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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.
 
4
#
 
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.
 
9
#
 
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
 
13
# USA
 
14
 
 
15
package GenTest::Transform::ExecuteAsUnion;
 
16
 
 
17
require Exporter;
 
18
@ISA = qw(GenTest GenTest::Transform);
 
19
 
 
20
use strict;
 
21
use lib 'lib';
 
22
 
 
23
use GenTest;
 
24
use GenTest::Transform;
 
25
use GenTest::Constants;
 
26
 
 
27
sub transform {
 
28
        my ($class, $original_query, $executor) = @_;
 
29
        
 
30
        return STATUS_WONT_HANDLE if $original_query !~ m{\s*SELECT}sio;
 
31
 
 
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;
 
35
 
 
36
        return [
 
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 */"
 
41
        ];
 
42
}
 
43
 
 
44
1;