2 use Test::More qw(no_plan);
5 use Data::Query::Renderer::SQL::Naive;
6 use Data::Query::ExprHelpers;
8 my $rend = Data::Query::Renderer::SQL::Naive->new({ quote_chars => [ "'" ] });
10 sub binding { map perl_scalar_value($_), @_ }
14 #::Dwarn($expr); return;
15 my $rendered = $rend->render($expr);
16 is_deeply($rendered, @_);
20 Select([ Identifier('*') ], Identifier('foo')),
21 ['SELECT * FROM foo'],
25 # should these both be allowed, and result in the same SQL?
29 Select([ Identifier('*') ], Identifier('foo')),
31 perl_operator('==', Identifier('foo', 'x'), Identifier('bar', 'y'))
33 ['SELECT * FROM foo JOIN bar ON foo.x = bar.y'],
34 'join on with dots (Join Select)';
42 perl_operator('==', Identifier('foo', 'x'), Identifier('bar', 'y'))
45 ['SELECT * FROM foo JOIN bar ON foo.x = bar.y'],
46 'join on with dots (Select Join)';
54 Literal('SQL', '?', [ binding(1) ],),
56 Select([ Identifier('*') ], Identifier('foo')),
58 ['SELECT * FROM foo WHERE x = ?', binding(1)],
59 'simple select with where and bind';
64 Select([ Identifier('*') ], Identifier('foo')),
66 ['SELECT * FROM foo GROUP BY x'],