Commit | Line | Data |
ea5d73f1 |
1 | #!/usr/bin/env perl |
2 | |
3 | use Test::More; |
4 | use SQL::Abstract::Test import => ['is_same_sql']; |
5 | use SQL::Abstract::Tree; |
6 | |
7 | my $sqlat = SQL::Abstract::Tree->new; |
8 | |
9 | my @sql = ( |
10 | "SELECT a, b, c FROM foo WHERE foo.a =1 and foo.b LIKE 'station'", |
11 | "SELECT * FROM (SELECT * FROM foobar) WHERE foo.a =1 and foo.b LIKE 'station'", |
12 | "SELECT * FROM lolz WHERE ( foo.a =1 ) and foo.b LIKE 'station'", |
13 | "SELECT [screen].[id], [screen].[name], [screen].[section_id], [screen].[xtype] FROM [users_roles] [me] JOIN [roles] [role] ON [role].[id] = [me].[role_id] JOIN [roles_permissions] [role_permissions] ON [role_permissions].[role_id] = [role].[id] JOIN [permissions] [permission] ON [permission].[id] = [role_permissions].[permission_id] JOIN [permissionscreens] [permission_screens] ON [permission_screens].[permission_id] = [permission].[id] JOIN [screens] [screen] ON [screen].[id] = [permission_screens].[screen_id] WHERE ( [me].[user_id] = ? ) GROUP BY [screen].[id], [screen].[name], [screen].[section_id], [screen].[xtype]" |
14 | ); |
15 | |
16 | for (@sql) { |
17 | is_same_sql($_, $sqlat->format($_), 'roundtrip works'); |
18 | } |
19 | |
20 | |
21 | done_testing; |