~drizzle-trunk/drizzle/development

0.67.655 by eve
misc fixes to the Simpipe simplification framework
1
use strict;
2
3
$| = 1;
4
5
use lib 'lib';
6
use GenTest::SimPipe::Testcase;
7
use GenTest::SimPipe::Oracle::Crash;
8
use GenTest;
9
use GenTest::Constants;
10
use GenTest::Executor::MySQL;
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=19300:user=root:host=localhost:database=test';
0.67.655 by eve
misc fixes to the Simpipe simplification framework
15
my $oracle = GenTest::SimPipe::Oracle::Crash->new( dsn => $dsn , basedir => '/home/philips/bzr/maria-5.3' );
16
$oracle->startServer();
17
18
my $dbh = DBI->connect($dsn, undef, undef, { mysql_multi_statements => 1, RaiseError => 1 });
19
20
my $query = "
21
22
SELECT alias2.f2
23
FROM t2 AS alias1
24
LEFT JOIN t3 AS alias2
25
LEFT JOIN t4 AS alias3
26
LEFT JOIN t1 AS alias4 ON alias3.f1 = alias4.f1 JOIN t5 AS alias5 ON alias3.f3 ON alias2.f1 = alias5.f5 ON alias1.f4 = alias2.f4
27
WHERE alias2.f2 ;
28
";
29
30
$dbh->do("DROP DATABASE IF EXISTS test; CREATE DATABASE test; USE test");
31
32
my $test = '/home/philips/bzr/randgen-simpipe/case.test';
33
open (Q, $test) or die $!;
34
while (<Q>) {
35
	chomp;
36
	next if $_ eq '';
37
	$dbh->do($_);
38
}
39
40
my $testcase = GenTest::SimPipe::Testcase->newFromDSN( $dsn, [ $query ]);
41
42
my $new_testcase = $testcase->simplify($oracle);
43
44
print $new_testcase->toString();