},
{
equal => 0,
- parenthesis_significant => 1,
+ opts => { parenthesis_significant => 1 },
statements => [
q/SELECT foo FROM bar WHERE a = 1 AND b = 1 AND c = 1/,
q/SELECT foo FROM bar WHERE (a = 1 AND b = 1 AND c = 1)/,
},
{
equal => 0,
- parenthesis_significant => 1,
+ opts => { parenthesis_significant => 1 },
statements => [
q/SELECT foo FROM bar WHERE a = 1 OR b = 1 OR c = 1/,
q/SELECT foo FROM bar WHERE (a = 1 OR b = 1) OR c = 1/,
},
{
equal => 0,
- parenthesis_significant => 1,
+ opts => { parenthesis_significant => 1 },
statements => [
q/SELECT foo FROM bar WHERE (a = 1) AND (b = 1 OR c = 1 OR d = 1) AND (e = 1 AND f = 1)/,
q/SELECT foo FROM bar WHERE a = 1 AND (b = 1 OR c = 1 OR d = 1) AND e = 1 AND (f = 1)/,
},
{
equal => 0,
- parenthesis_significant => 1,
+ opts => { parenthesis_significant => 1 },
statements => [
q/SELECT foo FROM bar WHERE a IN (1,2,3)/,
q/SELECT foo FROM bar WHERE a IN (1,3,2)/,
)]);
for my $test (@sql_tests) {
+
+ # this does not work on 5.8.8 and earlier :(
+ #local @{*SQL::Abstract::Test::}{keys %{$test->{opts}}} = map { \$_ } values %{$test->{opts}}
+ # if $test->{opts};
+
+ my %restore_globals;
+
+ for (keys %{$test->{opts} || {} }) {
+ $restore_globals{$_} = ${${*SQL::Abstract::Test::}{$_}};
+ ${*SQL::Abstract::Test::}{$_} = \ do { my $cp = $test->{opts}{$_} };
+ }
+
my $statements = $test->{statements};
while (@$statements) {
my $sql1 = shift @$statements;
foreach my $sql2 (@$statements) {
- no warnings qw/once/; # perl 5.10 is dumb
- local $SQL::Abstract::Test::parenthesis_significant = $test->{parenthesis_significant}
- if $test->{parenthesis_significant};
my $equal = eq_sql($sql1, $sql2);
TODO: {
}
}
}
+
+ ${*SQL::Abstract::Test::}{$_} = \$restore_globals{$_}
+ for keys %restore_globals;
}
for my $test (@bind_tests) {