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

« back to all changes in this revision

Viewing changes to tests/kewpie/randgen/lib/GenTest/Transform/ExecuteAsTrigger.pm

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

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::ExecuteAsTrigger;
 
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 || $original_query =~ m{LIMIT}sio;
 
31
 
 
32
        return [
 
33
                "DROP TABLE IF EXISTS trigger1".$$.",  transforms.trigger2".$$,
 
34
                "CREATE TABLE IF NOT EXISTS trigger1".$$." (f1 INTEGER)",
 
35
                "CREATE TABLE IF NOT EXISTS transforms.trigger2".$$." $original_query LIMIT 0",
 
36
                "CREATE TRIGGER trigger1".$$." BEFORE INSERT ON trigger1".$$." FOR EACH ROW INSERT INTO transforms.trigger2".$$." $original_query;",
 
37
                "INSERT INTO trigger1".$$." VALUES (1)",
 
38
                "SELECT * FROM transforms.trigger2".$$." /* TRANSFORM_OUTCOME_UNORDERED_MATCH */",
 
39
                "DROP TABLE IF EXISTS trigger1".$$.",  transforms.trigger2".$$
 
40
        ];
 
41
}
 
42
 
 
43
1;