refactor to add the rest of the setops
[scpubgit/Q-Branch.git] / xt / clauses.t
index a7d948d..66b971e 100644 (file)
@@ -164,7 +164,7 @@ is_same_sql(
   );
 }
 
-($sql) = $sqlac->select({
+$sql = $sqlac->select({
   select => { -as => [ \1, 'x' ] },
   union => { -select => { select => { -as => [ \2, 'x' ] } } },
   order_by => { -desc => 'x' },
@@ -175,4 +175,15 @@ is_same_sql(
   q{(SELECT 1 AS x) UNION (SELECT 2 AS x) ORDER BY x DESC},
 );
 
+$sql = $sqlac->select({
+  select => '*',
+  from => 'foo',
+  except => { -select => { select => '*', from => 'foo_exclusions' } }
+});
+
+is_same_sql(
+  $sql,
+  q{(SELECT * FROM foo) EXCEPT (SELECT * FROM foo_exclusions)},
+);
+
 done_testing;