753
by Roel Van de Paar
Adding pointers to /usr/bin/perl to avoid having to use perl somescript.pl & added extended sample configuration file for simplify-grammar.pl (simplify-grammar_template+.cfg) |
1 |
#!/usr/bin/perl
|
2 |
||
612
by eve
a foundation for a new simplification framework |
3 |
use strict; |
4 |
||
655
by eve
misc fixes to the Simpipe simplification framework |
5 |
$| = 1; |
6 |
||
612
by eve
a foundation for a new simplification framework |
7 |
use lib 'lib'; |
8 |
use GenTest::SimPipe::Testcase; |
|
9 |
use GenTest::SimPipe::Oracle::FullScan; |
|
10 |
use GenTest; |
|
11 |
use GenTest::Constants; |
|
655
by eve
misc fixes to the Simpipe simplification framework |
12 |
use GenTest::Executor::MySQL; |
612
by eve
a foundation for a new simplification framework |
13 |
use DBI; |
14 |
use Data::Dumper; |
|
15 |
||
655
by eve
misc fixes to the Simpipe simplification framework |
16 |
my $dsn = 'dbi:mysql:port=9306:user=root:host=127.0.0.1:database=test'; |
727.1.146
by eve
small fixes to simpipe.pl , now simpipe-fullscan.pl |
17 |
my $oracle = GenTest::SimPipe::Oracle::FullScan->new( |
18 |
dsn => $dsn, |
|
19 |
basedir => '/home/philips/bzr/maria-5.3' |
|
20 |
);
|
|
612
by eve
a foundation for a new simplification framework |
21 |
|
22 |
my $dbh = DBI->connect($dsn, undef, undef, { mysql_multi_statements => 1, RaiseError => 1 }); |
|
23 |
||
727.1.146
by eve
small fixes to simpipe.pl , now simpipe-fullscan.pl |
24 |
my $query = " SELECT 1 FROM DUAL "; |
655
by eve
misc fixes to the Simpipe simplification framework |
25 |
|
612
by eve
a foundation for a new simplification framework |
26 |
$dbh->do("USE test"); |
727.1.146
by eve
small fixes to simpipe.pl , now simpipe-fullscan.pl |
27 |
$dbh->do("SET SQL_MODE='NO_ENGINE_SUBSTITUTION'"); |
612
by eve
a foundation for a new simplification framework |
28 |
|
727.1.146
by eve
small fixes to simpipe.pl , now simpipe-fullscan.pl |
29 |
my $test = 'case.test'; |
655
by eve
misc fixes to the Simpipe simplification framework |
30 |
open (Q, $test) or die $!; |
31 |
read (Q, my $sql, -s $test); |
|
727.1.146
by eve
small fixes to simpipe.pl , now simpipe-fullscan.pl |
32 |
$test =~ s{LOCAL}{GLOBAL}sgio; |
655
by eve
misc fixes to the Simpipe simplification framework |
33 |
|
34 |
$dbh->do($sql); |
|
35 |
my $testcase = GenTest::SimPipe::Testcase->newFromDBH($dbh, [ $query ]); |
|
36 |
||
37 |
my $new_testcase = $testcase->simplify($oracle); |
|
38 |
||
39 |
print $new_testcase->toString(); |