0.67.612
by eve
a foundation for a new simplification framework |
1 |
use strict; |
2 |
||
0.67.655
by eve
misc fixes to the Simpipe simplification framework |
3 |
$| = 1; |
4 |
||
0.67.612
by eve
a foundation for a new simplification framework |
5 |
use lib 'lib'; |
6 |
use GenTest::SimPipe::Testcase; |
|
7 |
use GenTest::SimPipe::Oracle::FullScan; |
|
8 |
use GenTest; |
|
9 |
use GenTest::Constants; |
|
0.67.655
by eve
misc fixes to the Simpipe simplification framework |
10 |
use GenTest::Executor::MySQL; |
0.67.612
by eve
a foundation for a new simplification framework |
11 |
use DBI; |
12 |
use Data::Dumper; |
|
13 |
||
2465.1.4
by Brian Aker
Move from using 127.0.0.1, to localhost. |
14 |
my $dsn = 'dbi:mysql:port=9306:user=root:host=localhost:database=test'; |
0.67.655
by eve
misc fixes to the Simpipe simplification framework |
15 |
my $oracle = GenTest::SimPipe::Oracle::FullScan->new( dsn => $dsn , basedir => '/home/philips/bzr/maria-5.3' ); |
0.67.612
by eve
a foundation for a new simplification framework |
16 |
|
17 |
my $dbh = DBI->connect($dsn, undef, undef, { mysql_multi_statements => 1, RaiseError => 1 }); |
|
18 |
||
0.67.655
by eve
misc fixes to the Simpipe simplification framework |
19 |
my $query = " |
20 |
SELECT alias2.col_datetime_key AS field1 , alias2.pk AS field2
|
|
21 |
FROM t1 AS alias1 JOIN t1 AS alias2 ON alias2.pk = alias1.col_int_key AND alias2.pk != alias1.col_varchar_key
|
|
22 |
GROUP BY field1 , field2
|
|
23 |
ORDER BY alias1.col_int_key , field2;"; |
|
24 |
||
0.67.612
by eve
a foundation for a new simplification framework |
25 |
$dbh->do("USE test"); |
26 |
||
0.67.655
by eve
misc fixes to the Simpipe simplification framework |
27 |
my $test = '/home/philips/bzr/randgen-simpipe/case.test'; |
28 |
open (Q, $test) or die $!; |
|
29 |
read (Q, my $sql, -s $test); |
|
30 |
||
31 |
$dbh->do($sql); |
|
32 |
my $testcase = GenTest::SimPipe::Testcase->newFromDBH($dbh, [ $query ]); |
|
33 |
||
34 |
my $new_testcase = $testcase->simplify($oracle); |
|
35 |
||
36 |
print $new_testcase->toString(); |