sugar for select and multi-row insert
[scpubgit/Q-Branch.git] / xt / clauses.t
index 8b7427f..4e934f8 100644 (file)
@@ -96,4 +96,23 @@ is_same_sql(
   q{SELECT x.* FROM (SELECT * FROM y) AS x},
 );
 
+is_same_sql(
+  $sqlac->insert({
+    into => 'foo',
+    select => { select => '*', from => 'bar' }
+  }),
+  q{INSERT INTO foo SELECT * FROM bar}
+);
+
+($sql, @bind) = $sqlac->insert({
+  into => 'eh',
+  rowvalues => [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
+});
+
+is_same_sql_bind(
+  $sql, \@bind,
+  q{INSERT INTO eh VALUES (?, ?), (?, ?), (?, ?)},
+  [ 1..6 ],
+);
+
 done_testing;