X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F11parser.t;h=5ce1a8021a4362f13e81c14e69828c003d690312;hb=08e1636016045f0f3881f5af287dcfd482845fe9;hp=7cf65097eb928e424d3a919b0d83e085c0a58e8b;hpb=b4085a1a3c815de38ac86ca9e0bab01110b48c7e;p=dbsrgits%2FSQL-Abstract.git diff --git a/t/11parser.t b/t/11parser.t index 7cf6509..5ce1a80 100644 --- a/t/11parser.t +++ b/t/11parser.t @@ -533,6 +533,50 @@ is_deeply($sqlat->parse( "SELECT [screen].[id], [screen].[name], [screen].[secti ] ], 'real life statement 1 parsed correctly'); +is_deeply($sqlat->parse("CASE WHEN FOO() > BAR()"), [ + [ + "-MISC", + [ + [ + "-LITERAL", + [ + "CASE" + ] + ], + [ + "-LITERAL", + [ + "WHEN" + ] + ] + ] + ], + [ + ">", + [ + [ + "FOO", + [ + [ + "-PAREN", + [] + ] + ] + ], + [ + "BAR", + [ + [ + "-PAREN", + [] + ] + ] + ] + ] + ] +]); + + is_deeply($sqlat->parse("SELECT x, y FROM foo WHERE x IN (?, ?, ?, ?)"), [ [ "SELECT", @@ -811,7 +855,7 @@ is_deeply($sqlat->parse('SELECT foo FROM bar ORDER BY x + ? DESC, oomph, y - ? D ] ], 'Crazy ORDER BY parsed correctly'); -is_deeply( $sqlat->parse("META SELECT * * FROM (SELECT *, FROM foobar baz buzz) foo bar WHERE NOT NOT NOT EXISTS (SELECT 'cr,ap') AND foo.a = ? STUFF moar(stuff) and not (foo.b LIKE 'station') and x = y and a = b and GROUP BY , ORDER BY x x1 x2 y asc, max(y) desc x z desc"), [ +is_deeply( $sqlat->parse("META SELECT * * FROM (SELECT *, FROM foobar baz buzz) foo bar WHERE NOT NOT NOT EXISTS (SELECT 'cr,ap') AND foo.a = ? STUFF moar(stuff) and not (foo.b LIKE 'station') and x = y and z in ((1, 2)) and a = b and GROUP BY , ORDER BY x x1 x2 y asc, max(y) desc x z desc"), [ [ "-LITERAL", [ @@ -1047,6 +1091,44 @@ is_deeply( $sqlat->parse("META SELECT * * FROM (SELECT *, FROM foobar baz buzz) ] ], [ + 'IN', + [ + [ + '-LITERAL', + [ + 'z', + ], + ], + [ + '-PAREN', + [ + [ + '-PAREN', + [ + [ + '-LIST', + [ + [ + '-LITERAL', + [ + '1' + ] + ], + [ + '-LITERAL', + [ + '2' + ] + ], + ], + ], + ], + ], + ], + ], + ], + ], + [ "=", [ [