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

« back to all changes in this revision

Viewing changes to tests/kewpie/randgen/lib/GenTest/Transform/ConvertLiteralsToDyncols.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
 
#
2
 
# This program is free software; you can redistribute it and/or modify
3
 
# it under the terms of the GNU General Public License as published by
4
 
# the Free Software Foundation; version 2 of the License.
5
 
#
6
 
# This program is distributed in the hope that it will be useful, but
7
 
# WITHOUT ANY WARRANTY; without even the implied warranty of
8
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9
 
# General Public License for more details.
10
 
#
11
 
# You should have received a copy of the GNU General Public License
12
 
# along with this program; if not, write to the Free Software
13
 
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
14
 
# USA
15
 
 
16
 
package GenTest::Transform::ConvertLiteralsToDyncols;
17
 
 
18
 
require Exporter;
19
 
@ISA = qw(GenTest GenTest::Transform);
20
 
 
21
 
use strict;
22
 
use lib 'lib';
23
 
use GenTest;
24
 
use GenTest::Transform;
25
 
use GenTest::Constants;
26
 
 
27
 
my $initialized = 0;
28
 
 
29
 
sub transform {
30
 
        my ($class, $orig_query, $executor) = @_;
31
 
 
32
 
 
33
 
        # We skip LIMIT queries because LIMIT N can not be converted into LIMIT COLUMN_GET( COLUMN_CREATE () ) 
34
 
        return STATUS_WONT_HANDLE if $orig_query =~ m{LIMIT}sio;
35
 
 
36
 
        my @transformed_queries;
37
 
 
38
 
        {
39
 
                my $new_integer_query_const = $orig_query;
40
 
                my @integer_literals;
41
 
 
42
 
                $new_integer_query_const =~ s{\s+(\d+)}{
43
 
                        push @integer_literals, $1;
44
 
                        " COLUMN_GET(COLUMN_CREATE( $1 , $1 AS INTEGER ) , $1 AS INTEGER ) ";
45
 
                }sgexi;
46
 
 
47
 
                if ($new_integer_query_const ne $orig_query) {
48
 
                        push @transformed_queries, [
49
 
                                $new_integer_query_const." /* TRANSFORM_OUTCOME_UNORDERED_MATCH */ "
50
 
                        ];
51
 
                }
52
 
        }
53
 
 
54
 
        {       
55
 
                my $new_string_query_const = $orig_query;
56
 
                my @string_literals;
57
 
 
58
 
                $new_string_query_const =~ s{\s+'(.+?)'}{
59
 
                        " COLUMN_GET(COLUMN_CREATE( 1 , '$1' AS CHAR), 1 AS CHAR ) ";
60
 
                }sgexi;
61
 
        
62
 
                if ($new_string_query_const ne $orig_query) {
63
 
                        push @transformed_queries, [
64
 
                                $new_string_query_const." /* TRANSFORM_OUTCOME_UNORDERED_MATCH */ "
65
 
                        ];
66
 
                }
67
 
        }
68
 
 
69
 
        if ($#transformed_queries > -1) {
70
 
                return \@transformed_queries;
71
 
        } else {
72
 
                return STATUS_WONT_HANDLE;
73
 
        }
74
 
}
75
 
 
76
 
1;