Revision history for SQL::Abstract
- Fix parsing of NOT EXISTS
+ - Fix deep recursion warnings while parsing obnoxiously long sql statements
revision 1.72 2010-12-21
----------------------------
$self->_recurse_parse($tokens, PARSE_TOP_LEVEL);
}
+{
+# this is temporary, lists can be parsed *without* recursing, but
+# it requires a massive rewrite of the AST generator
+no warnings qw/recursion/;
sub _recurse_parse {
my ($self, $tokens, $state) = @_;
}
}
}
+}
sub format_keyword {
my ($self, $keyword) = @_;
use Test::More;
use Test::Deep;
+use Test::Warn;
use SQL::Abstract::Tree;
my $sqlat = SQL::Abstract::Tree->new;
]
], 'Lists parsed correctly');
+# test for recursion warnings on huge selectors
+warnings_are {
+ my $sql = sprintf 'SELECT %s FROM foo', join (', ', map { qq|"$_"| } 'aa' .. 'zz' );
+ my $tree = $sqlat->parse($sql);
+
+ is_deeply( $tree, [
+ [
+ "SELECT",
+ [
+ [
+ "LIST",
+ [
+ map { [ "LITERAL", [ qq|"$_"| ] ] } ('aa' .. 'zz')
+ ]
+ ]
+ ]
+ ],
+ [
+ "FROM",
+ [
+ [
+ "LITERAL",
+ [
+ "foo"
+ ]
+ ]
+ ]
+ ]
+ ], 'long list parsed correctly');
+
+ is( $sqlat->unparse($tree), $sql, 'roundtrip ok');
+} [], 'no recursion warnings on insane SQL';
+
done_testing;