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::ExecuteAsTrigger;
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 || $original_query =~ m{LIMIT}sio;
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".$$